Custom footer

Posted by: nelson.aguiar on 8 July 2024, 8:02 am EST

    • Post Options:
    • Link

    Posted 8 July 2024, 8:02 am EST - Updated 8 July 2024, 11:14 am EST

    In the footer, in a column, I only need to add the values ​​where the “Tp.entrance” column is equal to “Sales to the consumer”. And in another column, make an account with the sum of the “Consumer Sales” values ​​divided by the number of items. How to proceed?

  • 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.html

    In case, you face any issues, please let us know.

    Regards

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels