Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1775
Undo/Redo on Inserted rows value
posted

Hi,

Can you give a sample code to undo-redo insert operation and cell edit in XamDataGrid.

Our requirement demands undo-redo operation to be provided for the following scenario. Consider a XamDataGrid which has about 2 columns. 1. User creates a new row ( which is implemented using XAMDataGrid). 2. User enters the following data in the cells - '1' and '2'.

When user performs undo, the expectation is: 1st undo - revert value '2'. 2nd undo - revert value '1' 3rd undo - rever the insert row operation.

When user performs redo, the expectation is: 1st redo - insert row. 2nd redo - enter value '1' in first cell. 3rd redo - enter value '2' in second cell.

We have customised the undo and redo for 'insert' operation, but we are facing problem while executing the redo (the 2nd and 3rd redo operation listed above. during the 2nd and 3rd redo operations the values are coming as empty.)

Request your advise on this.

 

Regards,

Sasikumar

  • 138253
    Offline posted

    Hello Sasikumar,

     

    I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.

  • 54937
    Offline posted

    Or if you are trying to use the DataPresenter's built in undo support then you just need to create your own derived UndeleteRecordsStrategy and set it on the event args in the RecordsDeleting event. You need to make sure that your Undelete implementation returns a dictionary that maps from the provided RecordInfo instances to the actual dataitem that now represents the item after the undelete. The DataPresenter will use that information to fix up the history associated with those deleted records (e.g. the cell change history items so it now has a reference to the correct record/dataitem. Without that history entries related to the undeleted entries will not be fixed up. I'm guessing that is where you are having an issue. I've attached a basic sample that demonstrates a derived UndeleteRecordsStrategy.

    DataGridUndoDelete.zip
  • 138253
    Offline posted

    Hello Sasikumar,

     

    Thank you for your post. I have been looking into it and I can suggest you see the sample in the Samples Browser under Undo Redo Framework \ Organization \ Undo/Redo CRUD Operations in XamGrid section, where it is shown hot to achieve the functionality you want. The sample is about the XamGrid, but the same functionality can be used in XamDataGrid as well. Please let me know if this helps you or you need further assistance on this matter.

     

    Looking forward for your reply.