2011-09-03 50 views
1
var groupingFeature = Ext.create('Ext.grid.feature.Grouping'); 
Ext.create('Ext.grid.Panel', { 
    // other options 
    features: [groupingFeature] 
}); 

我可以在[groupingFeature]数组中添加新功能吗?我该怎么做?在ExtJS 4.0中,如何在网格中配置几个“功能”并在它们之间切换?

如果有几个功能,我怎么能在它们之间切换?


现在我知道如何设置几个特点(但我不知道阉这种方式正确与否):在此基础上的代码TableChunker.js

var groupingFeature = Ext.create('Ext.grid.feature.Grouping',{ 
    id: 'group', 
    ftype: 'groupingsummary', 
    groupHeaderTpl: '{name}', 
    hideGroupedHeader: true, 
    enableGroupingMenu: false 
}); 
var abstractSummaryFeature = Ext.create('Ext.grid.feature.AbstractSummary',{ 
    id: 'summary', 
    ftype: 'abstractsummary', 
    hideGroupedHeader: false, 
    enableGroupingMenu: true 
}); 
Ext.create('Ext.grid.Panel', { 
    // other options 
     dockedItems: [{ 
      dock: 'top', 
      xtype: 'toolbar', 
      items: [{ 
       tooltip: 'Change the feature', 
       text: 'Change', 
       handler: function(){ 
        var view = Ext.getCmp('sell_quote_item_grid').getView(); 
        view.getFeature('group').disable();//someone says I can toggle in this way, 
        view.getFeature('summary').enable();//I tried but failed... 
        view.refresh(); 
       } 
      }] 
     }], 
    features: [groupingFeature, abstractSummaryFeature] 
}); 
+0

现在我知道如何设置serval功能(但我不确定这种方式的天气是否正确): – TerryChen

+0

您是否仍需要关于切换部分的帮助? –

+0

我们找到了另一种方法来避免这个问题,但我想了解您的方法。 – TerryChen

回答

0

,它是作为简单的方法就是禁用不想呈现的“特征”。然后刷新视图。

你可以通过调用feature.disable(禁用功能),并通过调用feature.enable启用它(),它似乎是错误的,我希望feature.enable(启用= TRUE | FALSE)

for (; i < ln; i++) { 
     if (!features[i].disabled) { 
      features[i].mutateMetaRowTpl(metaRowTpl); 
      Ext.apply(memberFns, features[i].getMetaRowTplFragments()); 
      Ext.apply(tplMemberFns, features[i].getFragmentTpl()); 
      Ext.apply(tableTplMemberFns, features[i].getTableFragments()); 
     } 
    } 

一个更困难的问题是,你如何获得一个分组摘要和摘要在同一个表中一起工作。这是一个很难的事情。

相关问题