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

Grid Undo

Hi Mercy,

Could you please post a working version of grid undo functionality.
The commandstack.undo = true works in some cases
Thank yu
SC


5 Replies

JP Jeya Preetha M Syncfusion Team April 24, 2012 11:16 AM UTC

Hi Smitha,

Thanks for your interest in Syncfusion products.

Grid undo functionality is working in the current version 10.1.

Please let me know if you have any concerns.

Regards,
Jeya Preetha M



SM Smitha April 24, 2012 04:40 PM UTC

Hi,

Do u have any working sample for the undo functionality

Sc



MC Mercy C Syncfusion Team April 25, 2012 12:49 PM UTC

Hi Smitha,

Thanks for your update.

You can enable undo operation by setting "CommandStack.Enabled" property to "true".

this.gridControl1.CommandStack.Enabled = true;

please refer to the sample in the following link
http://www.syncfusion.com/downloads/Support/DirectTrac/93616/Undo-Redo841806248.zip

Please let me know if you have any concerns.

Regards,
Mercy.C




SM Smitha April 27, 2012 05:41 PM UTC

Hi Mercy,
I am unable to reproduce your undo functionality inmy grid
Here's my code

private void frm1(object sender, EventArgs e)
{

this.theGrid.AllowSelection = Syncfusion.Windows.Forms.Grid.GridSelectionFlags.Any;
this.theGrid.SelectCellsMouseButtonsMask = MouseButtons.Left;
contextMenu1.MenuItems.Add("Undo", new EventHandler(UndoCellsToolStripMenuItem_Click));
theGrid.Model.Options.ExcelLikeCurrentCell = true;
theGrid.Model.Options.ExcelLikeSelectionFrame = true;
theGrid.CommandStack.Enabled = true;
}
private void UndoCellsToolStripMenuItem_Click(object sender, EventArgs e)
{

if (!theGrid.CommandStack.InTransaction)
{

theGrid.CommandStack.Undo();
ShowStacks();
}
}
private void ShowStacks()
{
ShowRedoStack();
ShowUndoStack();
}

private void ShowUndoStack()
{
if (theGrid.CommandStack.UndoStack.Count != 0 && !(theGrid.CommandStack.UndoStack.Peek() is GridChangeCellsCommand))
{
theGrid.CommandStack.UndoStack.Pop();
}

if (theGrid.CommandStack.UndoStack.Count > 5)
{
theGrid.CommandStack.UndoStack.Clear();
}

}

Thank you
Smitha



RB Ragamathulla B Syncfusion Team May 4, 2012 10:54 AM UTC

Hi Smitha,

Thanks for your update.

Am afraid that am unable to reproduce your reported issue in our side and also we have the sample regarding your query please refer to the following path in our dashboard.

{InstalledPath}\Syncfusion\EssentialStudio\{Version}\Windows\Grid.Windows\Samples\2.0\MS Excel-Style Features\Undo-Redo Demo\

Let me know if you have any further concerns.

Regards,
Ragamathullah B.


Loader.
Live Chat Icon For mobile
Up arrow icon