Handsontable --footer

Tags: #<Tag:0x00007efc64948c40>

Is there is any option to add footer for handsontable.
I have a requirement to add footer to handson table and it contains totals of only few rows. attached mocktable i need to add totals row as footer.

Hi @ssrraju91

you can use fixedRowsBottom. Here is an example http://jsfiddle.net/fet1928r/

Thanks for your help Aleksandra,

I need to add new row at the end of the handsontable .That row contain a totals of some of the columns. we use “minSpareRows”: 1 to add one more row but i am not able to bind data to this row can you please help me how to bind the data to this empty row. Is this approach is correct??

Example: http://jsfiddle.net/fet1928r/1/

For example, you can test this approach http://jsfiddle.net/c66r1pm3/

I have added a single empty row at the end f the table via alter method (line: 34). Then added a formula (you have to remember to add the plugin first, line 31).
The formula is set to sum all values in the A column beside itself, so if you add or delete rows it will change.

Thank you very much for your help,

By using "hot.setDataAtCell(hot.countRows() - 1, 0, ‘=SUM(A1:A’ + (hot.countRows() - 1) + ‘)’) " i was able to bind sum values to last row.but “hot.alter(‘insert_row’, hot.countRows());” is not creating any new row to my table Is there any other alternative to create a row. we are using handsontable pro.

I also tried with “minSpreadRows” it is creating row at the bottom of the table and after refresh the row is getting deleted and data is appending to previous row.

It’s working fine in jsfidle example and not working properly in our application do we have any other configuration for this.

There’s also a possibility to add createRow hook to check if you are adding new rows and then update the SUM field. Here’s a demo http://jsfiddle.net/ecLky1md/

I have used one global variable for the hook to keep the last SUM field (variable myLastSum, line: 43). I am updating its value (row index) in the beforeCreateRow callback and then erase the old sum in the afterCreateRow callback. Also in the afterCreateRow I am adding the new sum.

Please feel free to test it and let me know if you need anything else.

Thank you aleksandra,

I am able to do the sum i don’t have any issue with summing the values.
but the row is not getting inserted every time. Is “minSpreadRows” plugin have some issues??

sorry “minSpareRows”

Hi @ssrraju91

yes, unfortunately, minSpareRows is facing some issue