Reputation: 27
Is it possible to add a summary without using a group.
var store = Ext.create('Ext.data.Store', {
model: 'Task',
groupField: 'reportType',
proxy: new Ext.data.HttpProxy({
url: 'getdata.php',
actionmethods: {read: 'POST'},
reader: {type: 'json', root:'data'}
}),
autoLoad: true
});
var showSummary = true;
var grid = Ext.create('Ext.grid.Panel', {
height: 450,
frame: true,
id: 'test',
iconCls: 'icon-grid',
renderTo: document.body,
store: store,
features: [{
id: 'group',
ftype: 'groupingsummary',
groupHeaderTpl: '{name}',
hideGroupedHeader: true,
enableGroupingMenu: true
}],
columns: [{
text: '',
width: 120,
tdCls: 'task',
sortable: true,
dataIndex: 'oppdesc',
hideable: false,
summaryType: 'count',
summaryRenderer: function(value, summaryData, dataIndex) {
return 'In-Period RR';
}
}, {
header: 'W1',
flex: 1,
sortable: true,
dataIndex: 'week1',
renderer : Ext.util.Format.usMoney,
summaryType: function(records){
var counter= 1;
var data1;
var data2;
Ext.Array.forEach(records, function (record){
if(counter ==1){
data1 = record.data.week1;
}
else {
data2 = record.data.week1;
}
counter++;
});
var summary = (data2/data1) * 100;
return summary;
}]
});
Summary for columns doesn't seem to appear when groupField config in store is not set. Summary for columns doesn't seem to appear when groupField config in store is not set.
Thanks!
Upvotes: 0
Views: 1136