2014-05-16 122 views
2

的一种方式是覆盖石斑鱼功能,以提供必要的功能..多分组做多列分组的5

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: { 
     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 
    } 
}); 

你可以建议我在做什么错在这里,当我伸出的石斑鱼类?

回答

2

尝试从grouper对象中删除'property'属性。

grouper: { 
     groupFn: function (item) { 
      return item.get('account') + ', Currency: ' + item.get('currCd'); 
     } 
    }