Summary Column React

Tags: #<Tag:0x00007f0b11358090>

Hello,
Is there any way to make a summary column on react hot with dynamic data?
I was sure that something like this will do the job:

columnSummary: [
{
destinationRow: 0,
destinationColumn: 0,
type: ‘sum’,
forceNumeric: true,
reversedRowCoords: true,
},
],

But than I am getting : Assertion failed: Expecting an unsigned number. Error.

Hi @pawel

the summary itself looks correct. I’ve used it here https://jsfiddle.net/wd1x72ra/ and we get the SUM working. This might be related to the way you actually load the data.
Could you use my Fiddle to share the logic of data loading?

So do I have to make empty row first to insert there a summary row? I am getting data from customer api and passing it hot by using component

{ <HotTable settings={{
dataSchema: {name: null, email: null, rola: null},
data: rows,
columns: [
{data: ‘data’, editor: false, type: ‘text’,},
{data: ‘imie_pracownika’, editor: false, type: ‘text’,},
{data: ‘nazwisko_pracownika’, editor: false, type: ‘text’,},
{data: ‘grupa_pracownika’, editor: false, type: ‘text’,},
{data: ‘roboczogodziny’, editor: false, type: ‘text’,},
{data: ‘suma_wyplaty’, editor: false, renderer: “numeric”,},
],
stretchH: “all”,
allowEmpty: true,
fillHandle: false,
colHeaders: [‘Data’ ,‘Imie’, ‘Nazwisko’, ‘Grupa’, ‘Roboczogodziny’, ‘Wyplata’],
columnSorting: true,
sortIndicator: true,
columnSummary: [
{
destinationRow: 0,
destinationColumn: 0,
type: ‘sum’,
forceNumeric: true,
reversedRowCoords: true,
},
],
}}}

If you do not have an empty row the summary will overwrite a cell with your data.

If you do not want to change the dataset you can use the alter() method to add a single empty row.