is there a way to add a summary row to jqgrid treeview

5.9k views Asked by At

i am using jqgrid with the treegrid view and most of the columns are numbers that are aggregated up the tree. The one missing piece is having a total row to aggregate the top level hierarchy. Is there something built into jqgrid to support this or should be passed down the:

1

There are 1 answers

8
Oleg On BEST ANSWER

Tree grid support footer row (see the second picture here) for tree grid in the same way like for the standard grid. If you calculate the content of the summary row on the server you can use userdata in the JSON input (see here). If you want have custom formatting of the summary row or if you want to calculate the values for the summary row on the client you can use footerData method inside of loadComplete for example. See here for an example.

The following simple demo produce the output: enter image description here

The changes in the original treegrid code are the following:

footerrow: true,
loadComplete: function () {
    $(this).jqGrid('footerData','set',
        {name:'TOTAL', num:"500", debit:"<i>Bla</i> Bla",
        credit:'20', balance:'<span style="color:red">-1000</span>'});
}