PDA

View Full Version : Grid Group Summary does not count sum



art.com
15 Feb 2013, 7:12 AM
Hi All,

This is my first post on the Sencha Forum. I am working on a view that uses a grid with groups and a summary for each group. The thing is that some fields are empty (the grid functions as an overview for several sub-departments). When the first field of a group is empty, the summary sums up the values on a rather strange way:

41878

I work with Sencha Architect 2 and tried several things. Leaving the first value of a group empty disturbs the sum of the summary. Is this a possible bug or is it impossible to leave the first field empty for a reason?

Json store:

{ data: [{
type: 'Physical count image cell',
cmf: 195,
rmf: 0,
mounting: 90,
canvas: 150,
lamination: 0,
group: 'End of day'
},{
type: 'Physical count finished image cell',
cmf: 40,
group: 'End of day'
},{
type: 'Physical count finished frame',
cmf: 40,
group: 'End of day'
},{
type: 'Physical count ready to fit',
cmf: 40,
group: 'End of day'
},{
type: 'Open B2B orders',
cmf: 0,
group: 'End of day'
},{
type: 'Regulars',
rmf: 0,
mounting: 10,
canvas: 6,
lamination: 20,
group: 'Pickings'
},{
type: 'No mat regulars',
cmf: 85,
rmf: 10,
mounting: 12,
group: 'Pickings'
},{
type: 'Mat regulars',
cmf: 75,
rmf: 10,
group: 'Pickings'
},{
type: 'Quick-frame',
cmf: 70,
group: 'Pickings'
},{
type: 'OB2b regulars',
cmf: 0,
group: 'Pickings'
}]
}

Part of the grid:

{ xtype: 'gridpanel',
columnWidth: 0.8,
margin: 20,
title: 'Daily workload',
enableColumnHide: false,
forceFit: true,
store: 'dailyWorkload',
viewConfig: {
disableSelection: true,
loadingHeight: 250
},
features: [
{
ftype: 'groupingsummary',
groupHeaderTpl: '{name}'
}
],
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
ptype: 'cellediting',
clicksToEdit: 1
})
],
columns: [
{
xtype: 'gridcolumn',
draggable: false,
width: 250,
sortable: false,
dataIndex: 'type',
hideable: false,
menuDisabled: true
},
{
xtype: 'numbercolumn',
summaryType: 'sum',
sortable: false,
align: 'right',
dataIndex: 'cmf',
hideable: false,
text: 'CMF',
format: '0,000',
editor: {
xtype: 'numberfield',
allowDecimals: false
}
},
{
xtype: 'numbercolumn',
summaryType: 'sum',
sortable: false,
align: 'right',
dataIndex: 'rmf',
hideable: false,
menuDisabled: true,
text: 'RMF',
format: '0,000',
editor: {
xtype: 'numberfield',
labelAlign: 'right'
}
},
{
xtype: 'numbercolumn',
summaryType: 'sum',
sortable: false,
align: 'right',
dataIndex: 'mounting',
hideable: false,
menuDisabled: true,
text: 'Mounting',
format: '0,000',
editor: {
xtype: 'numberfield',
labelAlign: 'right'
}
},
{
xtype: 'numbercolumn',
summaryType: 'sum',
sortable: false,
align: 'right',
dataIndex: 'canvas',
hideable: false,
menuDisabled: true,
text: 'Canvas',
format: '0,000',
editor: {
xtype: 'numberfield',
labelAlign: 'right'
}
},
{
xtype: 'numbercolumn',
summaryType: 'sum',
sortable: false,
align: 'right',
dataIndex: 'lamination',
hideable: false,
menuDisabled: true,
text: 'Lamination',
format: '0,000',
editor: {
xtype: 'numberfield',
labelAlign: 'right'
}
}
]
}

sword-it
15 Feb 2013, 8:02 AM
Hi,

see this link:http://demo.mysamplecode.com/ExtJs/pages/gridGroupSummary.jsp

art.com
17 Feb 2013, 11:24 PM
Thanks Sword-it for the link, lots of helpful examples. Unfortunately still no explanation for why the first empty field messes up the SUM summary of the column.

evant
17 Feb 2013, 11:29 PM
Because it's expecting a number, put this into your console:



'' + 85 + 75 + 70

art.com
17 Feb 2013, 11:40 PM
Hi Evant, thanks for your reply. So the first field should always contain a number? Because in the other columns the fields are also empty, but the summary sum still works correctly.

evant
18 Feb 2013, 1:57 AM
If you're trying to do an aggregate, it should contain numbers.