在 ExtJS 4.0 中,如何在网格中配置多个“功能”并在它们之间切换?
var groupingFeature = Ext.create('Ext.grid.feature.Grouping');
Ext.create('Ext.grid.Panel', {
// other options
features: [groupingFeature]
});
我可以将新功能添加到 [groupingFeature] 数组中吗?我该怎么做呢?
如果有多个功能,我如何在它们之间切换?
现在我知道如何设置几个功能(但我不确定这种方式是否正确):
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]
});
var groupingFeature = Ext.create('Ext.grid.feature.Grouping');
Ext.create('Ext.grid.Panel', {
// other options
features: [groupingFeature]
});
Can I add a new feature into the [groupingFeature] array? How can I do it?
And if there are several features, how can I toggle among them?
Now I know how to set several features (but I'm not sure wether this way is correct or not):
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]
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 TableChunker.js 中的这段代码,就像禁用您不想渲染的“功能”一样简单。然后刷新视图。
您可以通过调用 feature.disable() 来禁用某个功能,并通过调用 feature.enable() 来启用它,这似乎是错误的,我希望 feature.enable(enabled=true|false)
一个更困难的问题是如何获得groupingSummary 和 Summary 在同一个表中一起工作。这要困难得多。
Based on this code in TableChunker.js, it is as simple as disabling the "features" you don't want to render. and then refreshing the view.
You can disable a feature by calling feature.disable() and enable it by calling feature.enable() which seems wrong, I would expect feature.enable(enabled=true|false)
An even more difficult question is how do you get a groupingSummary and a Summary to work together in the SAME table. That is a good deal harder.