Restore dataitem to initial state

2 posts, 0 answers
  1. Richard
    Richard avatar
    6 posts
    Member since:
    Jan 2011

    Posted 22 Oct 2015 Link to this post


    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) {
      , 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.

  2. Kiril Nikolov
    Kiril Nikolov avatar
    2543 posts

    Posted 26 Oct 2015 Link to this post

    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.


    Kiril Nikolov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top