Grid ExtJS4网格分组头渲染器-如何指定?

Grid ExtJS4网格分组头渲染器-如何指定?,grid,grouping,extjs4,Grid,Grouping,Extjs4,有人知道如何在ExtJS4中将渲染器附加到网格分组头吗?在ExtJS3中,我有以下工作代码,如果事件已完成(Y),则返回“过去”,如果未完成,则返回“即将到来”: function fmt_group_heading(groupVal) { if (groupVal === 'Y') { return 'Past'; } else { return 'Upcoming'; } } // create the Grid

有人知道如何在ExtJS4中将渲染器附加到网格分组头吗?在ExtJS3中,我有以下工作代码,如果事件已完成(Y),则返回“过去”,如果未完成,则返回“即将到来”:

    function fmt_group_heading(groupVal) {
    if (groupVal === 'Y') {
        return 'Past';
    } else {
        return 'Upcoming';
    }
}

    // create the Grid
    var fitGrid = new Ext.grid.GridPanel({
       store: fitGroupingStore,
       columns: [
        {header: "ID", dataIndex: 'id', hidden: true },
                {header: 'Event', width:320, dataIndex: 'event',            
                            renderer:fmt_event_description},
                {header: 'Events',  dataIndex: 'completed',  hidden: true, 
                            renderer: fmt_group_heading }
    ],
    stripeRows: true,
    // config options for stateful behavior
    stateful: true,
    stateId: 'grid',
hideHeaders: true,
view: new Ext.grid.GroupingView({
    groupRenderer: 'completed',
    forceFit: true
})      
});
ExtJS4提供了网格分组,但我不知道如何更改组文本的输出。Ext.grid.feature.Grouping的“groupHeaderTpl”属性似乎只接受从存储读取的原始字段值

    this.groupingFeature = Ext.create('Ext.grid.feature.Grouping', {
        groupHeaderTpl: 'Group: {completed}'
    });

    // create the Grid
    this.fitnessGrid = new Ext.grid.Panel({
        store: this.fitnessEventStore,
        features: [this.groupingFeature],
            // etc.......
试着这样做:

groupHeaderTpl: “{[fmt_group_heading(values.name)]” ({rows.length} 项{[values.rows.length>1?/s”: “]}”


groupHeaderTpl要求您在编写模板时使用{name}。它将只使用groupField提供的值

.

试试这个:

 groupHeaderTpl: '{[values.rows[0].completed]}'