PDA

View Full Version : grid totals without grouping?



Kannabismus
28 Nov 2007, 9:07 AM
Is it possible to make total row just like in example Group Summary, but without groups (GroupingView, GroupingStore,...)? Example will be most useful :)

Gordon76
28 Nov 2007, 9:26 AM
If you do not want the GroupingView and Store you need to replace them with another of the available Views and Stores. The total amount of records in a store can be read with the store's getTotalCount() function. You could write this number in the bottom toolbar of the GridPanel.

For instance in your grid add

bbar: new Ext.Toolbar({items: ['<span id="total">0</span>']})
and in your store's load listener add

Ext.get('total').update(this.getTotalCount());

alks
29 Nov 2007, 4:53 AM
If you do not want the GroupingView and Store you need to replace them with another of the available Views and Stores. The total amount of records in a store can be read with the store's getTotalCount() function. You could write this number in the bottom toolbar of the GridPanel.

For instance in your grid add

bbar: new Ext.Toolbar({items: ['<span id="total">0</span>']})and in your store's load listener add

Ext.get('total').update(this.getTotalCount());
Hi Gordon76,
Can u have a look at my post,
http://extjs.com/forum/showthread.php?t=18632
and suggest me any changes. I m having a similar problem.
Thanks.

castitas
16 Mar 2012, 8:04 AM
I used a bbar with a grid inside of it (crazy, I know). I then added listeners on the parent grid's store's load and write events which summed the columns and set the corresponding column in the totalGrid (this means their column models have to be similar).