[GH #1712] Empty cells not added to the Hyperformula sheet values

Tags: #<Tag:0x00007f135fe73f50> #<Tag:0x00007f135fe73e10>

Hey there, I’m using Handsontable with Hyperformula and I have noticed that when I add new rows and columns at the end (last column or bottom row) they won’t be added to the values in Hyperformula automatically. Is this intentional?

This causes an issue if I try to do a different operation afterwards, like rowIndexMapper.setIndexesSequence. We get an error “Uncaught Error: Invalid arguments, expected number of columns provided to be sheet width” because the width/height wasn’t updated in Hyperformula when adding row or col in Handsontable.

I can get around it by manually adding an empty string in Hyperformula for each new cell created by the alter method in Handsontable, but it feels a bit messy and I’m wondering if there is something I should be doing differently to make sure the Hyperformula width/height is always correct.

Thanks :slight_smile:

Some screenshots to illustrate this
Initial table:


After adding some rows and columns at the ends (no change to Hyperformula values):

Trying to update sequence:

Hi @lizzie.gasson

HyperFormula’s method getAllSheetsValues will work correctly if you did add new rows/columns using HyperfFormula’s API: https://hyperformula.handsontable.com/api/classes/hyperformula.html#addcolumns

Adding rows/columns from Handsontable API will get you correct results with getData() method.

Hi @adrian.szymanski thanks for the quick response,

So is the reccomendation that if you are using Hyperformula with Handsontable, after using the alter method in Handsontable, then also addRows or addColumns in Hyperformula to keep them in sync? This seems unlikely to me since I can see there is syncChangeWithEngine function that runs in onAfterSetDataAtCell

I did have a go at adding this to my code, and unfortunately the issue still persists even if I add the new row or column in Hyperformula after adding it in Handsontable.

I’m sticking with adding the cell values for now, but I would really like to understand whether this is a bug that should be addressed in Hyperformula/Handsontable (specifically the error that shows up when using setIndexesSequence

Thanks!

Hi @lizzie.gasson

You are right. I investigated the issue further and indeed, it seems that adding columns or rows after the last initially indexed row/column doesn’t update the sheet array. Interestingly, it doesn’t happen if we want to add new row/column anywhere in between, or before the first indexes.

I reported this internally as a bug. I tried to find any workaround, but nothing unfortunatelly worked so far. If I find anything before we fix this issue I’ll let you know.

1 Like

Thanks for letting me know!