Reputation: 1397
So let's say I have this grid
id time
1 10
2 5
3 10
etc..
How do I get the sum of the values under 'time'?
EDIT
I tried to get the array of the value from the grid with this code
var sel2 = scope.getPlaylistDetailsGrid().data.items;
But it says: Uncaught TypeError: Cannot read property 'items' of undefined
Upvotes: 0
Views: 1162
Reputation: 1106
I think it would be usefull for others if i point it out as an answer.
You could use summary row, to achieve this behaviour. Here is example
Upvotes: 0
Reputation: 3114
If you want to display the sum in the grid, then Riku's suggestion of the summary row is perfect. If you need to just get a sum in code, you can check out the store's sum() method: http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.data.Store-method-sum
Riku's suggestion:
Upvotes: 2