GDBG Undo

I have some columns in a grid that I need to trap changes to so that I can refresh a diagram in another window. I''ve got this working by putting the logic in CurrentCellAcceptedChanges. However, I''m not able to trap any changes to these cells as a result of an Undo/Redo operation. 1) What is the best way to determine whether an Undo/Redo operation changed the contents of a cell and, if so, which column? 2) Some of the columns in question are custom with their own CellRenderer classes. How would I, on a column basis, specify that changes to the column should NOT be recorded on the Undo stack? Thanks!

1 Reply

AD Administrator Syncfusion Team August 22, 2004 06:04 AM UTC

1) Instead of CurrentCellAcceptedChanges, you might move your code to grid.Model.SaveCellInfo. This should be hit whether the change comes from the user or whether it is from a undo/redo. (If you need the value of the cell, get it from e.Style.CellValue.) 2) In grid.CurrentCellMoved, you can try turning off/on the commandstack when you are in a column that you do not want to support undo. Here is a try at turning it off for column 2.
private void gridDataBoundGrid1_CurrentCellMoved(object sender, GridCurrentCellMovedEventArgs e)
{
	GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
	if(cc.MoveFromColIndex == 2 && cc.MoveToColIndex != 2)
		this.gridDataBoundGrid1.Model.CommandStack.Enabled = true;
	else if(cc.MoveFromColIndex != 2 && cc.MoveToColIndex == 2)
		this.gridDataBoundGrid1.Model.CommandStack.Enabled = false;
}

Loader.
Up arrow icon