How can I save cell properties to localStorage?

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 javascript - Chrome sendrequest error: TypeError: Converting circular structure to JSON - Stack Overflow 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