This works on the handsontable demo site, but I can’t figure out what I might have done to stop it working on my HotTable.
If I delete a block of text and then press ctrl+z it doesn’t reappear. I’ve doing one or two calls to ‘setDataAtCell’ after every change (as i’m maintaining a hidden metadata column in column zero that each change can effect) - do you think that’s causing it? If so can I do a ‘setDataAtCell’ that doesn’t count for undo purposes?
Maybe you use loadData in your app? This method resets the Undo/Redo stack. I believe that updateSettings may reset the Undo/Redo stack depending on the property changed.
If that’s not helpful, I suggest to take a look at your DevTools console. Maybe there are some JS errors that break the app?
No JS errors BUT I have two HotTable’s on the same page and when you change the first one the second one updates. Could the update to the second one be destroying the undo/redo stack for the first?
I have two <HotTable> on a page (Table A, Table B) using the react integration
I make three changes to Table A, undo works
I make three changes to Table A, in one of the handlers for this change I change the data attribute for TableB. What happens: I can no longer undo changes on Table A. Expected: I should still be able to undo Table A changes.
Is it possible setting the data for Table B is wiping Table A’s undo cache?
I’m looking at the handsontable afterChange code and I can see return instance.undoRedo.clear(); in the onAfterChange callback but surely that should only apply to one instance and not all HotTables right?
I would need to know how do you wanted to make the change in Table B’s data in the first place. If you would like to discuss that I’ve made a demo in React with v8.2.0 using two tables https://jsfiddle.net/4uzkd20p/ We can fill it with the logic and check it together.
Helpful thanks, the fiddle’s are useful. I’m trying to refactor it to be a modern functional component but struggling a bit, any ideas? https://jsfiddle.net/w70yLbex/1/
After i change a cell in table1, table2 gets blanked. But when i press ctrl+z i can only go back one cell in table 1 - where’s the rest of my undo history gone? <-- is my question