Deleted row removed from grid even though errors returned in Destroy method

2 posts, 1 answers
  1. Shawn
    Shawn avatar
    51 posts
    Member since:
    Jul 2011

    Posted 30 Jun 2012 Link to this post

    I'm using Ajax binding, with the Destroy command.  The controller method fails with a business exception, which I add to the ModelState with the AddMModelError method.  This is then returned at the end of the method with the ModelState.ToDateSourceResult().
    In the UI I have the error event of the grid hooked up, which correctly displays the error as expected.  However, the "deleted" row is still removed from the Grid.  Am I doing something wrong?
  2. Answer
    Burke avatar
    41 posts
    Member since:
    Jun 2009

    Posted 28 Jul 2012 Link to this post


    I think that you need to tell the grid to rollback the changes.  Set the events property on the grid to get the error (which it sounds like you are already doing)

    Events(events => events.Error("error"));

    Now select the grid in the error function and rollback the changes.  I'm assuming your grid is named "grid".

    var error = function() {
    var grid = $("#grid").data("kendoGrid");
    // cancel changes

    That should do it.
Back to Top