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

混江龙づ霸主 提交于 2019-12-08 07:49:00

问题


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:


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:

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>'});
}


来源:https://stackoverflow.com/questions/7029511/is-there-a-way-to-add-a-summary-row-to-jqgrid-treeview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!