jspreadsheet / ce

Jspreadsheet is a lightweight vanilla javascript plugin to create amazing web-based interactive tables and spreadsheets compatible with other spreadsheet software.
https://bossanova.uk/jspreadsheet/v4
MIT License
6.66k stars 820 forks source link

setData not displaying values #1641

Closed data-handler closed 10 months ago

data-handler commented 10 months ago

When I initialize an instance of a spreadsheet and use the data option to set the initial data, everything works fine.

When I call setData to update the spreadsheet no values are displayed, yet the number of rows match the length of the data.

If I try destroying the instance via jspreadsheet.destory(element, true) then re-initialize, I get the below error:

TypeError: Cannot set properties of null (setting 'current') at obj.init

data-handler commented 10 months ago

Further to the above. After calling setData when I call getJson on the instance, it has the correct number of rows an cells but all cell values are set to an empty string ('')

If I pass the exact same data on initialization, the values are displayed correctly, so I'm sure my data is not the issue.

Please advise

hodeware commented 10 months ago

// Dont send the second argument, that will destroy the events and clear the memory. jspreadsheet.destory(element)

// You might be using the wrong format (array or json), when defining setData.

data-handler commented 10 months ago

This did not address my original issue where setData was not displaying any values..

The json supplied is precisely the same as that when using the data option, as stated in my second comment.

What fixed the setData issue was reverting to the 'latest' version displayed on the repository home page (4.13.1). When using the npm version (4.13.4) setData does not work for me.

Thank you