css - How to show column footer in grouped grid in AngularJS ui-grid? -
i'm using angularjs ui-grid , followed tutorial show column footer of gird, worked fine. however, after added grouping function in grid, column footer disappeared.
from 105_footer tutorial, used aggregate column values:
aggregationtype: uigridconstants.aggregationtypes.sum
in grouping's column definition, added aggregate column values:
treeaggregation: {type: uigridgroupingconstants.aggregation.sum}
the problem column aggregation isn't aware of grouping, trying blindly aggregate visible rows in column. result in wrong answer.
there 2 forms of wrong here:
grouping default puts labels text - "max: 30" example in age column. aggregation cannot aggregate. can fix customfinalizerfn, i've done in plunker below
aggregation aggregates visible rows, including groupheader rows. if had 1 level of grouping , expanded all, sum aggregation end double real value. if had 2 levels of grouping triple.
in short, think it's bad idea use column footers , column level aggregation grouping.
http://plnkr.co/edit/1znbxeldzenvk3x3g1c2?p=preview
showgridfooter: true, showcolumnfooter: true, { name: 'age', treeaggregationtype: uigridgroupingconstants.aggregation.max, aggregationtype: uigridconstants.aggregationtypes.avg, width: '20%', customtreeaggregationfinalizerfn: function( aggregation ){ aggregation.rendered = aggregation.value; } },
Comments
Post a Comment