-
28 Mar 2012 11:49 PM #1
Adding a new Row wth dynamic values
Adding a new Row wth dynamic values
I want to add a Row which would show the sum of all the values prior to it.
How can I do that ?Really dont know what to do....
Ex:
aaa val1 val2 aaa 12 23 aaa 23 45 Total 35 68 bbb 10 16 bbb 16 10 Total 26 26
-
29 Mar 2012 9:08 PM #2
I want to render it from the server side only..I am getting the values of individual datas..i just want to render another row which would show their sum...
-
17 May 2012 11:05 PM #3
try this
try this
Hi,
When you get the response from server, loop thro the corresponding dataIndex and keep
adding the sum.Add a value to the store which contains the sum. It should work.
-
21 May 2012 1:29 AM #4
use store.insert
use store.insert
Add load event listener to your store, so we can start process when store loads:
This would probably work, give it a try!Code:var store = new Ext.data.JsonStore({..... listeners: {load: function(store, records, options){var total = 0, rowValue = 0, totalRowRecord;for(var i = 0, len = records.length; i < len; i++){rowValue = parseInt(records[i].get('value'));rowValue = !isNaN(rowValue) ? rowValue : 0;if(((i + 1) % 5 === 0) || ((len % 5) > 0 && i === len - 1)){ //for each 5 records or for the last record show total rowtotal += rowValue;totalRowRecord = new (store.reader.recordType)({ name: 'Total', value: total });store.insert(i, totalRowRecord); //insert total row total = 0; //set 0 again} else {total += rowValue;}}}}});
Regards.sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.


Reply With Quote