Column total in footer with lable

Tags: #<Tag:0x00007efc616509c8>

Column total in the footer with lable. Like total, Count. only for numeric columns.

Hi @suman.dutta

It sounds like the summary calculations might be a good pick for you https://handsontable.com/docs/9.0.1/demo-summary-calculations.html

Have you already tested them?

Yes I have tried it. But it is not working because data is loading from api later. Can you please tell me if there is any other way to do that?

You can still use it but with the help of updateSettings() method. The following method can be used to pass/overwrite any settings you had in the initialization.

Tried with that not showing total. Any other way ?

columnSummary: [

        {

          destinationRow: 0,

          destinationColumn: 3,

          reversedRowCoords: true,

          type: 'sum',

          forceNumeric: true

        }],

Used this settings. No total avialble

I am sorry @suman.dutta

It seams that defining columnSummary via updateSettings does not work at the moment https://github.com/handsontable/handsontable/issues/3597

However, I can propose an alternative https://jsfiddle.net/handsoncode/4f5er397/
In the following demo I use Js reduce method based on the getDataAtCol method. I run it after the initialization so you can pass the dataset when you want. Then I call the same function within afterChange hook so the value gets updates when user changes data.

Let me know if it works for you.

Thank you for your response. I will try it and let you know

Of course. I also offer my help in other topics if you would have any questions, @suman.dutta

When i apply the filter it is not working

I think that you can use the afterFilter hook to the already defined function. Here’s an example https://jsfiddle.net/handsoncode/wxfr9ovc/