Having a totals row in handsontable

Tags: #<Tag:0x00007fee2a61cbf8>

Hello,
in our application we want to add a new row at the top of the table that would either sum up or create an average (based on some config) of the elements of the collum.

For now, we have this row in a table in our app and there we dinamically calculate and update those values. We want to add this row also in another place in our application, where we also use filtering and sorting. There we have to fix two issues:

  1. to always keep this row as the first row of the table, no matter how the table is sorted
  2. to not be able to filter this row out from the handsontable filters;

Could you please help? When we first implemented this we had hadnsontable version 7, but now we are finalizin an upgrade to the latest version. We are opened to any possible solution here, so we can consider also completely different solutions

Hi @marius.comiati

Regarding your first issue, it can be solved as presented in this example: https://jsfiddle.net/aszymanski/4v6gbn09/2/

About the second one. Currently we don’t have any examples showing such implementation but it should be possible to do within beforeFilter hook: https://handsontable.com/docs/javascript-data-grid/api/hooks/#beforefilter

1 Like