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

GGC binding to business object and CommandStack

Hi together,

I am using a GGC which is bound to a business object (BindingList). Now I want to use the CommandStack option for undo and redo operations. So I activated the commandstack via:

ggc.TableModel.CommandStack.Enabled = true;

After I changed a cell value I do the following in my undo method:

if (!ggc.TableModel.CommandStack.InTransaction)
{
ggc.TableModel.CommandStack.Undo();
}

So Undo() is called but the cell value remains. What do I have to implement in my business object to support the commandstack?

Thank's for any help

Cheers,
Tom

2 Replies

AD Administrator Syncfusion Team December 8, 2006 09:05 AM UTC

The GGC does not support the Undo/Redo architecture that is provided by GridControlBase. So, if you want to use this Undo/Redo support, you would have to add custom commands (derived from the abstract GridModelCommand) to manage the actions you want to support. Here is a minimal sample showing one way to handle undo/redo on user changed values. It uses a TableControlCurrentCellValidating to cache the old value, and TableControlCurrentCellAcceptedChanges to create an instance of the custom command and push it on the CommandStack. I also had to manually manipulate the Undo and Redo stacks.

http://www.syncfusion.com/Support/user/uploads/GGC_UndoReDoValueChanged_c430cbee.zip


AD Administrator Syncfusion Team December 8, 2006 02:46 PM UTC

Hi Clay,

nice to "read" from you - Your example is great, thanks a lot.

Cheers

Loader.
Live Chat Icon For mobile
Up arrow icon