EXt的Grid中的CheckboxSelectionModel默认勾选

EXt的Grid中的CheckboxSelectionModel默认勾选

ewqGridStore.addListener("load",function(){ //ewqGridStore是grid中加载数据的store
   var records=[];//存放选中记录
    var roombos = eroomboshid.getValue(); //eroomboshid 为后台传过来的要勾选的数据
   var roombosstr = [];
   if('undefine' != roombos){
	  if(roombos.indexOf(';')!=-1){
		roombosstr = roombos.split(';');
	  }else{
		roombosstr[0] = roombos;
	  }
   }
   for(var i=0;i<ewqGridStore.getCount();i++){
	var record = ewqGridStore.getAt(i);
	for(var j=0;j<roombosstr.length;j++){
	    if(record.data.bosid==roombosstr[j]){//按照后台数据断定那些记录默认选中
		records.push(record);
            }
	}
   }
   //ewqGridCheckbox 为CheckboxSelectionModel对象
   ewqGridCheckbox.selectRecords(records);//履行选中记录 
});

 

     

 

      

 

你可能感兴趣的:(ExtJs,grid,combobox,勾选)