tags:

views:

80

answers:

1
+1  A: 

As I'm not sure what aspect of the problem you are having difficulty with, I'll address both at a high level. Generally speaking you want to have your reconfigure method update the Ext Store, which will then trigger an event that the Grid should handle. Basically, change the Store and your Grid will be updated automatically.

As far as generating the correct new row... it seems fairly straightforward - a rough pass:

/*for each field foo_X through foo_N:*/
var lastElementIndex = store.data.size-1; 
var total = 0;
for (var i=0; i<; i++) {
    if (i != lastElementIndex) {
        total += store.data[i].get(foo_X)*i;
    } else {
        total = total/store.data[i].get(foo_x);
    }

}
/*construct your json object with the field foo*/
/*after looping through all your fields, create your record and add it to the Store*/
Aaron