Posted 8 July 2024, 8:02 am EST - Updated 8 July 2024, 11:14 am EST
Custom footer
Posted by: nelson.aguiar on 8 July 2024, 8:02 am EST
-
-
Posted 9 July 2024, 8:58 am EST
Hi Nelson,
You can calculate the aggregate value as per your requirements, by iterating over the items in the grid’s collectionView and then set the calculated aggregate values in grid’s column footer cells using the setCellData method. You can use the ‘refreshing’ event of the FlexGrid for this purpose so that aggregate values stay updated when data in the grid is updated.
Please refer to the following sample demonstrating the same - https://stackblitz.com/edit/js-tl1qbp?file=index.js
In the above sample, we have calculated the aggregate for the ‘Sales’ column by adding the column value where ‘Product’ is ‘Phones’. Similarly, you can calculate aggregates as per your requirements.
We have set the ‘aggregate’ property of the Expenses column to ‘Avg’ which will calculate the average of the column values, you can use this property as per your need, or you can implement your own custom logic to calculate aggregates as described above. Here is the API link for possible values for aggregate property in the FlexGrid column for your reference - https://developer.mescius.com/wijmo/api/enums/Wijmo.Aggregate.htmlIn case, you face any issues, please let us know.
Regards