Calculating a Sum Across Rows in Datagrid

I have the below datagrid. I’d like to sum up all the values in the ‘Total’ column and display that summed amount as a text field below the datagrid. What’s the best way to achieve this please? Do the sum in front or back-end? If front-end, how do I achieve that?

I figured it out again using the excellent Co-Pilot AI! But still curious if doing it in the front-end, and then again in the back-end if/when needed, is the right approach?

It will depend of the amount of data you have.
If the maths are easy to do, and are just informative (i suppose for a total here thats the case) doing it in the front is perfectly fine.
If you have pagination (lot of data) and want the total on all the page, best is to have the back giving it.

1 Like

Thanks @aurelie. Yes in this case the total is just informative for the user, so front-end makes sense.