This is a migrated thread and some comments may be shown as answers.

Restore dataitem to initial state

1 Answer 122 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 22 Oct 2015, 03:15 PM

Hi,

I have a grid in batch edit mode. ​The grid is using a local data source. It has a custom template for a command button which becomes visible if the row's data item is dirty. This is working fine. My problem is I'd like to roll-back that data item to its initial state when the button is clicked regardless of whether the row is in edit mode or not. 

This is the event that fires when the undo button is clicked.

var theGrid = $("#layersGrid").data("kendoGrid");
        theGrid.table.on('click', '.undo-button', function (e) {
            setToInitialState.call(theGrid, e);
        });​

  function setToInitialState(e) {
        var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
    }

How do I revert the data item to its initial state ?

Thank you.

1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 26 Oct 2015, 08:51 AM

Hello Richard,

 

There is no built-in mechanism for such functionality, so the suggestion is to just get a copy of the dataItem before the change, that you can use later if needed to be restored.

 

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Richard
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Share this question
or