undo redo


Hi,

I noticed for some odd reason that undo (Ctrl-Z) only works if I stay within the current cell. As soon as I click out of the cell that I just changed, it doesn't remember how to undo it anymore. The redo function seems to have a longer memory. Am I doing something wrong?

5 Replies

AD Administrator Syncfusion Team October 19, 2007 11:52 AM UTC

The multilevel undo/redo support is only available in GridControl. Is this the control you are using?

For the bound grid like GridDataBoundGrid and GridGroupingControl, the undo does not retain a history. There, normally, the first undo resets the current cell and the second undo resets the entire record. But, if you are using settings like DirectSaveCellInfo = true in GridDataBoundGrid or ForceImmediateSaveValue = true in a GridGroupingControl, or if you are handling editing events and explicitly calling something like EndEdit, then this may also interfere with undos.


JO John October 19, 2007 09:50 PM UTC


Hi,

Is the DirectSaveCellInfo set true by default?


JO John October 19, 2007 09:53 PM UTC



Hi,

Sorry, I forgot to mention that I am using griddataboundgrid.



AD Administrator Syncfusion Team October 20, 2007 07:21 AM UTC

The default value of DirectSaveCellInfo is false.

I tried things with a GridDataBoundGrid. I also see the second control Z not resetting the current record. But I think you can get this wroking by handling the keydown event and cancelling the edit on the binder if your user hits ctlZ on a editing row that does not have a editing currentcell. Here is a little sample.

WindowsApplication25.zip


JO John October 24, 2007 03:30 PM UTC


Hi,

I tried looking at the sample that was provided and I still can't get the second Ctrl-Z to do undo the second operation.

I specifically had trouble getting this part of the code to return a true value:

if(e.KeyCode == Keys.Z && e.Control
&& !gridDataBoundGrid1.CurrentCell.IsEditing
&& gridDataBoundGrid1.Binder.IsEditing)
{
return true; //never returns true
}



I tried just running this to see if I could get the second Ctrl-Z to undo, but it still wouldn't undo the operation.

if(true)
{
gridDataBoundGrid1.Binder.CancelEdit();
}


I'm not sure what I'm doing wrong. =( Any help would be greatly appreciated. Thanks!

Loader.
Up arrow icon