当前位置: 代码迷 >> Web前端 >> 用checkbox顶替Ext.grid.CheckboxSelectionModel()实现disabled
  详细解决方案

用checkbox顶替Ext.grid.CheckboxSelectionModel()实现disabled

热度:426   发布时间:2012-06-29 15:48:46.0
用checkbox代替Ext.grid.CheckboxSelectionModel()实现disabled

ext有Ext.grid.CheckboxSelectionModel() 可是却少了个disabled的属性? 找了很多地方没找到合适的方法去解决? ,直接用checkbox代替

?

columns:[
??? ??? ??? ??? ??? {//列表 header 头信息 new Ext.grid.RowNumberer(),
??? ??? ??? ??? ??? ??? header: '<input type="checkbox" onclick="selectAll(this)" name="selectAll" id="selectAll" style="width:13px; height:13px;"/>',
??? ??? ??? ??? ??? ??? dataIndex: 'check',
??? ??? ??? ??? ??? ??? width:30,
??? ??? ??? ??? ??? ??? sortable: false,
??? ??? ??? ??? ??? ??? renderer:function(v, cellmeta, record){
??? ??? ??? ??? ??? ??? ??? return record.get('Addr')!=''?'<input type="checkbox" onclick="selectSingle(this)" name="each" rel="each" style="width:13px; height:13px;"/>':'<input type="checkbox" disabled= "disabled" rel="each" style="width:13px; height:13px;"/> ';
??? ??? ??? ??? ??? ??? }
??? ??? ??? ??? ??? }

]

?

?

?

selectAll = function(self){
??? ??? ??? var checkEl = Ext.get('wrap').query("[rel='each']");
??? ??? ??? for(var i = 0,j = checkEl.length; i < j;i++){
??? ??? ??? ??? if(checkEl[i].name == 'each'){
??? ??? ??? ??? ??? checkEl[i].checked = self.checked;
??? ??? ??? ??? ??? Ext.getCmp('invoice-Enroll').store.getAt(i).data.check = self.checked ? 1 : 0;
??? ??? ??? ??? }
??? ??? ??? }
??? ??? }

  相关解决方案