任何人都知道如何將渲染器附加到ExtJS4中的網格分組標題中?在ExtJS3我有以下工作代碼,它返回「過去」事件是否已經完成(「Y」),或「即將」如果沒有完成:ExtJS4網格分組標題渲染器 - 如何指定?
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.......