解决exjtjs3.3中gridpanel中动态加载列时使用selModel无效的问题
创建GridPanel
1 _createGridPanel : function(){
2 var sm = new Ext.grid.CheckboxSelectionModel();
3 sm.handleMouseDown = Ext.emptyFn;
4 var Host = Ext.data.Record.create([
5 {name: 'isAgentOk', mapping: 'isAgentOk',type :'boolean'},
6 {name: 'ip', mapping: 'ip'}
7 ]);
8 var proxy = new Ext.data.PagingMemoryProxy(this.hosts.sort(function(a,b){
9 return a.isAgentOk===true ? 1 : -1;
10 }));
11 var reader = new Ext.data.JsonReader({
12 totalProperty: 'totalProperty',
13 root: 'rows'
14 },Host);
15 var store = new Ext.data.Store({
16 reader :reader,
17 proxy : proxy
18 });
19
20 var cm = new Ext.grid.ColumnModel({
21 defaults : {
22 sortable : false,
23 align : 'left',
24 menuDisabled : true
25 },
26 columns :[
27 sm,{
28 header : "agent状态",
29 dataIndex : 'isAgentOk',
30 renderer: function(value, metaData, record) {
31 metaData.css = "bold";
32 return value===true ? '正常' : '异常';
33 }
34 }, {
35 header : "JobIP",
36 dataIndex : 'ip',
37 renderer: function(value, metaData, record) {
38 metaData.css = "bold";
39 return value;
40 }
41 }]
42 });
43
44 var gridPanel = new Ext.grid.GridPanel({
45 id : this.id + '_HostGridPanel',
46 name : this.id + '_HostGridPanel',
47
48 headerCfg : {
49 tag : 'div',
50 html : '<span id="'+this.id+'_spanIPInfo">本次导入[<label style="color:#FF0000;"> 0 </label>]个IP, 共计导入[<label style="color:#FF0000;"> 0 </label>]个IP;agent检测状态异常的IP数量共计[<label style="color:#FF0000;"> 0 </label>];</span>',
51 style : 'font-family:Tahoma,Arial,Helvetica,sans-serif;font-size:15px;transparent;border-bottom:1px solid #99BBE8;'
52 },
53 autoHeight : true,
54 autoScroll : true,
55 stripeRows : true,
56 loadMask : {
57 msg :'正在加载数据,请稍等…'
58 },
59
补充:web前端 , JavaScript ,