0

I want to get the summary of the column stay time on my grid. But I can't seem to understand or figure out how to use the summary grid in extjs. Could anyone please help me or guide me?

Here's my grid code:

Ext.ns('dlti.view.widget');


Ext.define('dlti.view.widget.PlaylistDetailsGrid' ,{
extend: 'Ext.grid.Panel',
id: 'playlist-details',
alias: 'widget.PlaylistDetailsGrid',
forceFit: true,
stripeRows: true,
selType: 'rowmodel',
autosync: true,
height: 150,
width: 950,


store: new dlti.store.PlaylistDetailsStore(),


columns: [


    {
        text: 'Filename',
        dataIndex: 'filename',
        renderer:   function renderDescTarget(val, p, record) {
            var desc = '';
            desc = '<p style="color:#000;font-size:12px;">' + val + '</p>';
            return desc;
        }
    },
    {
        text: 'Transition',
        dataIndex: 'transition',
        renderer:   function renderDescTarget(val, p, record) {
            var desc = '';
            desc = '<p style="color:#000;font-size:12px;">' + val + '</p>';
            return desc;
        }
    },
    {
        text: 'Stay Time',
        dataIndex: 'timeframe',
        renderer:   function renderDescTarget(val, p, record) {
            var desc = '';
            desc = '<p style="color:#000;font-size:12px;">' + val + '</p>';
            return desc;
        }
    }



]
});
maecy m
  • 1,287
  • 3
  • 15
  • 20

1 Answers1

0

You can specify summaryType and summaryRenderer like this:

    summaryType: 'count',
    summaryRenderer: function(value, summaryData, dataIndex) {
         return ((value === 0 || value > 1) ? '(' + value + ' Tasks)' : '(1 Task)');
    }

summaryType can have values like count, max, average, sum etc. and summaryRenderer is similar to the column renderer where you can give any custom logic for formatting the summary.

Rajinder
  • 346
  • 2
  • 7
  • summaryType: 'count', summaryRenderer: function(value, summaryData, dataIndex) { alert(1); // Why this is coming for more than 1 time for 2 rows its coming for 8 times } – aswininayak Nov 05 '13 at 13:00
  • May be your grid is rendered multiple times..see if you are refreshing the grid view somewhere. – Rajinder Nov 19 '13 at 09:00