var checkBox = new Ext.grid.CheckboxSelectionModel({});

var ds= new Ext.data.Store({  
                    proxy: new Ext.data.HttpProxy({url:'contentAction_list.do'}),//调用的动作  


                    reader:_jsonReader,
                    listeners : {  
                    load : function(ds) {  
                        var records = new Array(); 
                        var index=0;
                        ds.each(function(record) {  
                         if(record.data.p3 != 0) {
                                 records.push(record);  //这个push同javaHashSet一样可以去重复的
                                 //checkBox.setValue(true);
                             //checkBox.selectRow(index);//用这个也是可以的
                            }index++;
                           
                        });  
                        checkBox.selectRecords(records, true);// 以后每次load数据时,都会默认选中  
                    }  
                }  
                }); 
               var cm = new Ext.grid.ColumnModel([new Ext.grid.RowNumberer(),
 checkBox,...略

 var grid = new Ext.grid.GridPanel({   
                     region:'center', 
                    ds : ds,  
                    store: ds,   
                    cm:cm,
                     sm:checkBox,

 

--- 网络上有个某个列禁止被选择的用这个事件:beforerowselect:这个监听可以写在:CheckboxSelectionModel({});里面。

添加beforerowselect 在选中之前触发的事件,return就不能选择了。
添加事件CheckboxSelectionModel{
beforerowselect: function () {
return;
}
}

 


arrow
arrow
    文章標籤
    Extjs checkboxSelectionModel
    全站熱搜

    Frank 發表在 痞客邦 留言(0) 人氣()