Javascript extjs5中的多分组
进行多列分组的一种方法是重写Grouper函数以提供必要的功能Javascript extjs5中的多分组,javascript,extjs,extjs5,Javascript,Extjs,Extjs5,进行多列分组的一种方法是重写Grouper函数以提供必要的功能 Ext.util.Grouper.override({ getGroupString: function (item) { return item.get('account') + ', Currency: ' + item.get('currCd'); } }); // Define summary store Ext.define('xxx.store.Summaries', { e
Ext.util.Grouper.override({
getGroupString: function (item) {
return item.get('account') + ', Currency: ' + item.get('currCd');
}
});
// Define summary store
Ext.define('xxx.store.Summaries', {
extend: 'Ext.data.JsonStore',
alias: 'store.summaries',
requires: ['xxx.view.summary.SummaryGrouper'],
model: 'xxx.model.Summary',
storeId: 'summaryStore',
grouper: {
property: 'account'
},
执行此分组的另一种方法是按存储区中的grouper属性进行分组
grouper: {
property: 'account',
groupFn: function (item) {
return item.get('account') + ', Currency: ' + item.get('currCd');
}
},
这是第一次使用,但是,当我刷新时,它没有使用我给它的groupFn,只是按帐户分组。我猜这与配置有关。你能告诉我为什么吗
另一种方法是扩展石斑鱼,但我认为我做错了什么。没有人打电话给我,或者我做错了什么
//定义摘要grouper
Ext.define('Banking.view.summary.SummaryGrouper', {
extend: 'Ext.util.Grouper',
alias: 'widget.summaryGrouper',
isGrouper: true,
initComponent: function () {
this.callParent(arguments);
},
config: {
groupFn: function(record) {
return record.get('account') + ', Currency:' + record.get('currCd');
},
sortProperty: 'account'
},
constructor:function(cfg){
this.callParent(arguments);//Calling the parent class constructor
this.initConfig(cfg);//Initializing the component
}
});
当我扩展Grouper类时,您能指出我在这里做错了什么吗?尝试从Grouper对象中删除“property”属性
grouper: {
groupFn: function (item) {
return item.get('account') + ', Currency: ' + item.get('currCd');
}
}