jspreadsheet / pro

Jspreadsheet Pro | The javascript spreadsheet
https://jspreadsheet.com/
14 stars 1 forks source link

Get the Updated formula #322

Closed JohnPatrickOshaughnessy closed 4 months ago

JohnPatrickOshaughnessy commented 4 months ago

I have a sheet with may formulas. When I prgrammatically insert or update a row, the formula references are updated and the calculations remain correct. However I need to get the updated formula to highlight the cells referenced in the formula. My problem is that although the formula calculations are correct following a row insert/delete if I get the value of the cell containing a formula then the formula contains the original unchanged references. In other words although the spreadsheet calculations are behaving expected when rows are inserted or deleted the actual formula (that I get as a result of sheet.getValueFromCoords()) is the original formula, without the updated references.

How do I get the new formula once it has been transformed following row insertion/deletion?

hodeware commented 4 months ago

That is done automatically. Maybe you are trying a reference for another sheet? How are you getting the value? getValue? image

JohnPatrickOshaughnessy commented 4 months ago

Yes I am using getValue - as I said above, the calculations are correct when a row is inserted but when I retrieve the formula it is wrong. See the screenshot, the formula should be updated to '=SUM(H1:E12)' image

hodeware commented 4 months ago

Are you using react? Can you replicate that on codesandbox? Can you contact support@jspreadsheet.com, please?

JohnPatrickOshaughnessy commented 4 months ago

I am not using React. Please see the example in my last comment where I use the example spreadsheet on your website. On your page I clicked insert row 4 times, you can see that the formula in the Total row is the original unchanged formula - The strange thing is that the calculations are correct, it's just the formula string that is wrong.

JohnPatrickOshaughnessy commented 4 months ago

For the record I have determined that the issue seems to be associated witg jss v10. If the cells with formulas are set to readonly then the formula does not auto-increment/decrement when a row is inserted/deleted.