tags:

views:

29

answers:

0

I am using a jqgrid (3.8) and I want some help in loading Summary row at runtime.

My grid is getting data locally (i.e. datatype:"local"), from an object that is being constructed due to some user operations (no server roundtrip).

For e.g. my datasource looks like this:

MyCollection = [
    {name:"a", price:"10.2", ...},
    {name:"a", price:"10.2", ...},
    {name:"a", price:"10.2", ...}
];

Meanwhile, "myCollectionsGrid" is already displaying without any rows. As soon as I get some data I do the following...

// in my array def. there is code to "$(document).trigger("collection_changed")

$(document).bind('collection_changed', function (event, utils_obj){
    ...
    ...
    $("#myCollectionGrid").jqGrid('clearGridData'); // clear grid
    // add new rows
    for (var i = 0; i < MyCollection.length; i++) 
    {
        $("#cartItems").jqGrid('addRowData', 1, 
            MyCollection[i]);
    }
    ...
    ...
});

...I want the grid to recalculate the totals (say "price" column above). The grid displays the rows nicely but it doesn't group and it also shows empty footer rows.

Anyone have an idea how I can get this done?

~~ Thanks in advance ~~