1. #1
    Sencha User
    Join Date
    Feb 2013
    Location
    Venray NL
    Posts
    19
    Vote Rating
    0
    Answers
    1
    art.com is on a distinguished road

      0  

    Default Answered: Grid Group Summary does not count sum

    Answered: Grid Group Summary does not count sum


    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:

    grid.png

    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:
    Code:
    {    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:
    Code:
    {    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'
                }
            }
        ]
    }
    Attached Images

  2. Because it's expecting a number, put this into your console:

    Code:
    '' + 85 + 75 + 70

  3. #2
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Vote Rating
    85
    Answers
    124
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  4. #3
    Sencha User
    Join Date
    Feb 2013
    Location
    Venray NL
    Posts
    19
    Vote Rating
    0
    Answers
    1
    art.com is on a distinguished road

      0  

    Default


    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.

  5. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,169
    Vote Rating
    674
    Answers
    474
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Because it's expecting a number, put this into your console:

    Code:
    '' + 85 + 75 + 70
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  6. #5
    Sencha User
    Join Date
    Feb 2013
    Location
    Venray NL
    Posts
    19
    Vote Rating
    0
    Answers
    1
    art.com is on a distinguished road

      0  

    Default


    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.

  7. #6
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,169
    Vote Rating
    674
    Answers
    474
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    If you're trying to do an aggregate, it should contain numbers.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Thread Participants: 2