我正在尝试将 expandAll() 和 collapseAll() 用于分组网格 Ext 4.1
但它在覆盖后不起作用:出现错误 expandAll() 未定义
Ext.override(Ext.grid.feature.Grouping, {
collapseAll: function() {
var self = this, view = self.view;
view.el.query(self.eventSelector).forEach(function (group) {
var group_body = Ext.fly(group.nextSibling, '_grouping');
self.collapse(group_body);
});
},
expandAll: function() {
var self = this, view = self.view;
view.el.query(self.eventSelector).forEach(function (group) {
var group_body = Ext.fly(group.nextSibling, '_grouping');
self.expand(group_body);
});
}
});
这是我的视图文件:
Ext.define('MCT.view.MyGrid',
{
extend:'Ext.grid.Panel',
initComponent:function(){
var me = this;
this.bbar = [{xtype:'button',text:'Expand All', handler:function(){
me.features[0].expandAll();
this.callParent(arguments);
}}];
},
features : [{
ftype : 'grouping',
groupHeaderTpl :'.......',
startCollapsed : true
}]
});
在此先感谢您的帮助!!