Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove row and undo/redo with object data source. #966

Closed
Shynklaw opened this issue Aug 12, 2013 · 3 comments
Closed

Remove row and undo/redo with object data source. #966

Shynklaw opened this issue Aug 12, 2013 · 3 comments

Comments

@Shynklaw
Copy link

Hello,

Use any examples with object data source at http://handsontable.com/demo/datasources.html, fiddle it and set "contextMenu:true", like in this fiddle http://jsfiddle.net/96XYQ/
Then, use remove row, and now try undo from context menu. You just can't undo it.
It's very specific with arrays of objects, because the first example without objects on the page work fine ( -> http://jsfiddle.net/ydaFm/ ).

Have a nice day.

@ghost ghost assigned psmolenski Aug 13, 2013
@Shynklaw
Copy link
Author

I think i've spotted the flaw which seems to cause this :
(into 'alter' method, line 560 of v0.9.12)

changes = [];
newData = datamap.getAll();
for (r = 0, rlen = newData.length; r < rlen; r++) {
    for (c = 0, clen = newData[r].length; c < clen; c++) {
        changes.push([r, c, oldData[r] ? oldData[r][c] : null, newData[r][c]]);
    }
}
instance.PluginHooks.run('afterChange', changes, source || action);

As you are only processing only arrays of arrays, each properties of objects aren't stored in the "changes" array, thus not added to the undo/redo array.

@psmolenski
Copy link
Contributor

I've gone through the whole UndoRedo mechanism and found that it does not handles undoing and redoing operations related to altering table structure well. I'm currently rewriting UndoRedo and aim to merge my changes before version 0.9.14 is released.

@psmolenski
Copy link
Contributor

Fixed in version 0.9.17. Please, upgrade and confirm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants