Slickgrid Grouped header ShowTotal

蹲街弑〆低调 提交于 2020-01-15 03:27:10

问题


How can I show the total average and total cost on Duration(Expanded/collapsed) row where number of items are instead of at the bottom in a separate row?

here is the fiddle for it http://jsfiddle.net/c76xW/3/

dataView.setGrouping([
    {
      getter: "duration",
      formatter :function (g) {
        return "Duration:  " + g.value + "  <span style='color:green'>(" + g.count + " items)</span>";
      },
      aggregators: [
        new Slick.Data.Aggregators.Sum("duration"),
        new Slick.Data.Aggregators.Sum("cost")
      ],
      aggregateCollapsed: true,
      lazyTotalsCalculation: true
    },

回答1:


You would have to modify it a bit. JSfiddle link with updated code is here. Be careful with the aggregateCollapsed and lazyTotalsCalculation - they need to be set to true if you want to access the average and sum in that way, but it also means it will run slower since it's doing it for each and every group at the same time and not when the user is looking at them.



来源:https://stackoverflow.com/questions/35140813/slickgrid-grouped-header-showtotal

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