1

以下是我的代码片段: store-
>

   this.segmentsList = { segments: [] };
   this.segmentfields = [ {name: 'pvName', mapping : 'pvName'},         
                          {name: 'tierName', mapping : 'tierName'}] 
   this.segmentsStore = new Ext.data.JsonStore({
                         fields : this.segmentfields,
                         autoLoad: true,         
                         data   : this.segmentsList,            
                         root   : 'segments'         
                         });  

网格->

this.datatieringSelectModel = new Ext.selection.CheckboxModel({checkOnly:true});
      this.segmentsGrid = new Ext.grid.Panel({
         autoScroll : true
         ,id: 'segmentsGrid'
         ,store: this.segmentsStore
         ,height:200
         ,border: true
         ,columns: [           
              {header : 'TierName',  sortable: false, dataIndex: 'tierName'}
             ,{header : 'PV Name', sortable: false, dataIndex: 'pvName'}
         ]
         ,viewConfig: {forceFit: true}
         ,selModel:this.datatieringSelectModel
         ,selType:'checkboxmodel'         
         ,enableColumnHide : true
         ,stripeRows: true
      });
  this.datatieringSelectModel.on('select', this.checkboxSelectedHandler, this);

我用以下数据填充我的网格:

{ "segments":  [{"tierName": "tire4","pvName": "d2"}
               ,{"tierName": "tire3","pvName": "d1"}]}

现在,当我选择任何复选框时,会触发 select 事件并调用 checkboxSelectedHandler 方法:

checkboxSelectedHandler: function(selectionModel, record, rowIndex ) {            
                 tierName = 'tier2';                     
                 record.set("tierName",tierName);
                 record.commit();                
   }

在这里它成功更新了轮胎名称,但复选框中的刻度线消失了。在调试时,我观察到刻度线一旦 record.set("tierName",tierName); 被调用。请建议如何在不影响相应复选框选择的情况下更新 tierName 单元格。

4

0 回答 0