simsalabim/sisyphus

How to restore dynamically added inputs

Opened this issue · 1 comments

I dynamically create a new grid row on several forms when the user clicks an ‘Add Row’ button. All of the data in those new rows gets correctly saved to localStorage. My problem is they don’t get restored if the user doesn’t save the page before, e.g., crashing. When the user returns, the ‘new’ dynamically added controls are no longer in the document, so those values are ignored during restore.

I’m just now getting started on figuring out how to ‘re-insert’ those nodes to the document when restoring.

I’m posting here in the hopes that someone has experience to share that would give me a head start.

@agloa You'll have to track the document structure yourself and restore it before sisyphus does anything.

//restore document structure here...
let sisyphusedForm = $(form).sisyphus();