If I have a few cells
1 2 3
And I change them to
0 2 0
If I undo twice, it will restore it to
1 2 3
Shouldn’t it take three undos? One for each cell?
That way when people are changing cells they don’t have to guess how many values were the same when doing undo’s. (Especially when you paste 20-30 cells at a time)
Is this a bug? I know it is in the 2.1 version. Wasn’t sure if it was fixed in 2.5
Actually this is expected behavior, if operation doesn’t change data it doesn’t registered in undo|redo stack.
While it may be confusing in your use-case, it is expected behavior for many other scenarios.
dhtmlxgrid_undo.js
dhtmlXGridObject.prototype._onEditUndoRedo = function(stage, row_id, cell_index, new_value, old_value)
{
if (this._IsUndoRedoEnabled && stage == 2 && old_value != new_value) {
removing last check will change behavior to the one, which is necessary in your case
What happens if they go into a cell then leave it without doing anything? If I remove that code, would something like that go on the stack?
Yep, if check will be removed - any edit operation ( even without any change of data, just opening and closing of editor ) will be stored in undo history.