We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

GDBG undo/redo problem

We are currently using the GridDataBoundGrid with the Undo/Redo feature. The Undo/Redo only seems to work on every other change. Here are the steps: 1) User makes change to cell 1,1 and hits tab 2) User makes change to cell and hits tab 3) repeat several times 4) hit ctrl-z to undo everything 5) every other change does not get undone. It appears that the undo is not always committed. Has anyone encountered this before? Bob

1 Reply

AD Administrator Syncfusion Team May 22, 2005 09:48 PM UTC

Every other undo is probably undoing a selection command which does not really show up in the UI. Try this. First, set this.gridDataBoundGrid1.Binder.DirectSaveCellInfo = true; to avoid problem of the grid caching changes until you leave the row. If you want to transparently process the selection commands so your user sees a change with each ctlZ, in the undo menu handler (which has a ctlZ hotkey), use code like:
private void menuItem2_Click(object sender, System.EventArgs e)
{
	if(this.gridDataBoundGrid1.Model.CommandStack.UndoStack.Count > 0)
		this.gridDataBoundGrid1.Model.CommandStack.Undo();

	object o = null;
	if(this.gridDataBoundGrid1.Model.CommandStack.UndoStack.Count > 0)
		o = this.gridDataBoundGrid1.Model.CommandStack.UndoStack.Peek();
	while(o is GridSelectionStateCommand)
	{
		this.gridDataBoundGrid1.Model.CommandStack.Undo();
		if(this.gridDataBoundGrid1.Model.CommandStack.UndoStack.Count > 0)
			o = this.gridDataBoundGrid1.Model.CommandStack.UndoStack.Peek();
		else
			o = null;
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon