我在网格视图行中使用 SummaryType:sum 计算了总行。如果用户选择组合,我需要显示商店的 Total Row 值。我的网格值来自不同的商店。谁能告诉我该怎么做?
Ext.define('TestGrid.view.GlobalTeamTable1', {
extend: 'Ext.grid.Panel',
alias: 'widget.globalteamtable1',
id:'gridid',
features: [{
ftype: 'summary'
}],
store: Ext.create('TestGrid.store.TestResultStore'),
columns: [{
dataIndex: 'month',
text: 'Month',
summaryRenderer: function(){
return '<b>Totals:</b>';
}
}, {
dataIndex: 'target1',
text: 'Target1',
summaryType: 'sum'
}, {
dataIndex: 'target2',
text: 'Target2',
summaryType: 'sum'
}, {
dataIndex: 'targetDiff',
text: 'Target(2-1)',
summaryType: 'sum'
}, {
dataIndex: 'targetPercent',
text: 'Target%',
summaryType: function(records){
var totals = records.reduce(function(sums, record){
return [sums[0] + record.data.target2,
sums[1] + record.data.targetDiff];
}, [0,0]);
return (totals[0] * totals[1]) / 100;
}
}]
});
谢谢