我想使用expandAll()和collapseAll()爲一組網格分機4.1如何使用ExpandAll和CollapseAll對於使用分組功能
但分組電網公司不重寫後的工作: 收到錯誤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
}]
});
在此先感謝您的幫助!
感謝您的答覆......它爲Chrome正常工作。但在IE瀏覽器拋出錯誤:對象不支持屬性或方法'forEach' – aswininayak 2013-03-08 06:51:27
這裏是修復IE <9 – aswininayak 2013-03-08 07:07:03
添加此腳本文件內: if(!Array.prototype.forEach){ \t Array .prototype.forEach = function(fn,scope){var i = 0,len = this.length; i
aswininayak
2013-03-08 07:07:48