有没有一种方法可以将摘要行添加到jqgrid treeview [英] is there a way to add a summary row to jqgrid treeview
问题描述
我正在将 jqgrid和treegrid视图一起使用,列中的数字是在树上聚合的数字.一个缺失的部分是总行以汇总顶级层次结构. jqgrid中是否内置支持此功能的东西,或者应该将其传递给以下对象:
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:
推荐答案
树网格支持页脚行(请参见第二张图片此处).如果要对摘要行进行自定义格式设置,或者要在客户端上计算摘要行的值,可以使用此处.
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:
原始treegrid代码中的更改如下:
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>'});
}
这篇关于有没有一种方法可以将摘要行添加到jqgrid treeview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!