Formula not updating upon adding columns and column values not updating

Tags: #<Tag:0x00007efc7290a130>

Greetings,

I have add two button where it could add columns at certain point. The columns are added as expected however the value for the adding right column are not updated to the correct value and the last three column with the formulas are not updating the formulas as the column are being added. By updating means, for example initially the formula calculating SUM of A1:C1 after adding columns the formulas should update as SUM of A1:D1.

Here is the link to the fiddle

Regards,
Harvindran

Hi @harvindran.chandrase

The supported way to update the data is

  • alter() - adds empty rows and columns
  • setDataAtCell/setDataAtRowProp - adds a single value to a cell
  • spliceCol() /spliceRow - replaced/shift data as mentioned at https://handsontable.com/docs/api/core/#splicecol
  • setData()/loadData() - replaces all the data and recalculates the plugins
  • updateData() - replaces all the data and do not recalculate the plugins

we do not recommend using splice()/pop() etc. on the data array. Please use one of the following methods listed above.

1 Like

Hi,

I managed to create adding column with spliceCol(), however now when I use columns to customize the cell type like dropdown or numeric the spliceCol() giving out error.

Here is the link to the fiddle

Ah, yes. That is correct. If you use an object data source or use columns you would need to use updateSettings( columns: new_array). This is the only way to alter the columns number (other than destroying and repairing it again).