[轉]extjs grid的Ext.grid.CheckboxSelectionModel默認選中解決方法


原文地址:http://379548695.iteye.com/blog/1167234

grid的復選框定義如下:
 
Js代碼   收藏代碼
  1. var sm = new Ext.grid.CheckboxSelectionModel({  
  2.                     handleMouseDown : Ext.emptyFn,  
  3.                     singleSelect : false  
  4.                 });  
 

 為grid的store添加load監聽如下:

 

Js代碼   收藏代碼
  1. store.addListener('load',function(){  
  2.    var records=[];//存放選中記錄  
  3.    for(var i=0;i<store.getCount();i++){  
  4.     var record = store.getAt(i);  
  5.     if(record.data.lcss==0){//根據后台數據判斷那些記錄默認選中  
  6.      records.push(record);  
  7.     }  
  8.    }  
  9.    sm.selectRecords(records);//執行選中記錄  
  10.   }); 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM