sisyphus icon indicating copy to clipboard operation
sisyphus copied to clipboard

How to restore dynamically added inputs

Open agloa opened this issue 5 years ago • 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 avatar Sep 30 '18 13:09 agloa

@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();

unguul avatar Mar 02 '19 10:03 unguul