Hi Oli, found this long-winded loophole (or should I say technique!) to duplicate a row on the table. Sharing the steps.
Undo button:
$("#history-undo").on("click", function(){
$("#stops-table").tabulator("undo");
});
And Redo button likewise.
DeleteRow function is executed
// retrieve index value from an input field. Have set one column as index.
$("#stops-table").tabulator("deleteRow", index) );
}
Sequence of actions and results:
[row is present on table]
rowDelete - row deleted
Undo - row restored. Pressing undo again: no effect.
Redo - row deleted. Pressing redo again: no effect.
Undo - row restored.
Undo - another copy of the same row added, table has 2 identical rows now.
Redo - one row deleted, 1 remains. Pressing redo again: no effect.
Undo - another copy of row added despite there being one present, table has 2 rows
Undo - another copy added, table has 3 rows.
// loop begin
Redo - one row deleted, table has 2 rows. Pressing redo again: no effect.
Undo - another copy of row added despite there being one present, table has 3 rows
Undo - another copy added, table has 4 rows.
// loop end
... Repeat [Redo, Undo, Undo] sequence to keep on adding additional copies of the same row.
Click for Live code example
Which version of tabulator are you using?
Tabulator v3.4.3 . Oh you've done an upgrade, let me check with v3.4.4 and get back to you.
Had done with v3.4.3, just downloaded v3.4.4 and re-tested, same experience.
browser details: Chromium Version 64.0.3282.167 (Official Build) Built on Ubuntu , running on Ubuntu 16.04 (32-bit)
Hey @answerquest
Thanks for testing it on 3.4.4, i will have a look into it this weekend and see if i can include a fix in this weekends patch release.
Cheers
Oli :)
Hey @answerquest
Sorry for the delay in getting back to you on this on. I have just pushed a fix for this to the 3.5 branch, which should be released later in the week.
Turns out that the delete row undo/redo action was triggering another history action of its own, which was clogging up the history with fake undo/redo markers.
This should be all sorted with the new release.
Thanks for the detailed explanation, that really helped get to the bottom of the issue.
Cheers
Oli :)
Hey @answerquest
Version 3.5 has now been released!