Kendo - 网格 - FooterTemplate中的自定义聚合 [英] Kendo - Grid - Custom Aggregate in FooterTemplate

查看:489
本文介绍了Kendo - 网格 - FooterTemplate中的自定义聚合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的理解是,Kendo不支持自定义聚合,但可以在footerTemplate中调用一个函数。该函数可以提供数据计算,甚至可以引用kendo定义的聚合。因此,例如,

My understanding is that Kendo does not support custom aggregates but you can call a function in the footerTemplate. That function then can provide calculations on the data and can even reference kendo defined aggregates. So, for example,

footerTemplate: "<div><b>Range</b> #= computeRange()#</div>"

如果这是正确的,您将如何编写函数computeRange?它会使用max-min聚合。

If this is correct, how would you write the function computeRange? It would use max-min aggregates.

另外,你将如何编写computeMedian函数?

Also, how would you write a computeMedian function?

提前申请帮助。

Thanks in advance for your help.

推荐答案

function computeRange(){
    var bal         =   0;
    var ds          =   $("#itemcode_grid").data("kendoGrid").dataSource;
    var aggregates  =   ds.aggregates();
    if(aggregates.total_balance)
        bal         =   aggregates.total_balance.sum;
    else
        bal         =   0;
    return kendo.toString(bal,'n2');
}

这篇关于Kendo - 网格 - FooterTemplate中的自定义聚合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆