How can I save cell properties to localStorage?

Tags: #<Tag:0x00007efc64474070>

Hello,

I would like to save all cell properties via getCellMeta to localStorage but I get a following error:
Uncaught TypeError: Converting circular structure to JSON

I used a following code:

for (var row = 0; row < ROWS; row++) {
  for (var col = 0; col < COLS; col++) {
    currentSheetProperties[row][col] = hot.getCellMeta(row, col);
  }
}
// save array
localStorage["properties"] = JSON.stringify(currentSheetProperties);

In the last source code row I got that error. Demo
https://jsfiddle.net/janzitniak/qohba3m0/20/

Regards
Jan

Hi @jan.zitniak

As mentioned here https://stackoverflow.com/questions/4816099/chrome-sendrequest-error-typeerror-converting-circular-structure-to-json you’re passing something that holds the reference. The cellmeta for a single cell holds the reference to the instance of Handsontable

You should, however, be able to save the cellmeta while skipping the instance.

1 Like