2014-04-22 50 views
0

我有以下分组报头格:EXTJS 4分组的列标题的动态文本修改

var lestore = Ext.create('Ext.data.Store', { 
     proxy: { 
       type: 'memory' 
       }, 
     autoDestroy: true, 
     data:objstore 
    }); 

thegrid = Ext.create('Ext.grid.Panel', { 
     store: lestore, 
     columnLines: true, 
     columns: [{text:'date'},{text:'TV',columns:{text:'400',columns:[{text:'tt1'},{text:'tt2'}]}] , 
     title:'my title' , 
     selModel: { 
      selType: 'cellmodel' 
     }, 
     renderTo: 'gridmpoff', 
      plugins: [Ext.create('Ext.grid.plugin.CellEditing', {clicksToEdit: 1} 
       ) 
       ], 

     listeners: {'edit': function(editor,e) {updtitle(editor,e);} 
     }, 
     viewConfig: { 
      stripeRows: true 
     }, 

    }); 

我所需要的网格创建之后改变列文本(TT1,TT2等),在不改变报头分组。

我试着修改列属性,但这并没有帮助,只有那些迄今为止工作的东西是重新配置与编辑器混淆。

请指点

回答

0

这么多的搜索后,我来到了的想法,ExtJS的4.1“重新配置”是越野车,也从未得到修复,因为它与插件(特别是编辑)食堂,每修复到目前为止我发现的目标只是一个特定的用例,我只是更新了分组标题标签而没有触及其他任何东西。

我使用的解决方案是简单地更新dom(同时更新extjs的列标题结构,以便如果某些时候它们的错误是固定的,则很容易切换到重新配置,settext或其他),通过:thegrid.container.dom.childNodes ....

我希望这有助于从这场斗争中得到别人。

这是有关:Using Ext.grid.Panel.reconfigure() breaks the grids RowEditing plugin

0

试试下面的代码:

grid.columns[0].ownerCt.setText('Total Number'); 
0

我知道这是一个古老的线程,但你可以使用代码迈克尔贴:

grid.columns[0].ownerCt.setText('Total Number'); 

,然后用您的groupHeaderTpl中的列名称,并具有类似如下:

{columnName}: {name} 

这样它会动态地将其更改为您想要的值。