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

Pre-loader to call Ajax call for inline editing

1 Answer 251 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mohammed Nazrul
Top achievements
Rank 1
Mohammed Nazrul asked on 19 Mar 2013, 11:19 AM
I need to change some records of a row through inline editing. The scenario is, after edit button / class is trigger, the request will call an action of a controller where we need a callback from server to check validation and wait…… until server responded. To do that, we need to know the answers: 

01) How can we add / set (ajax) pre-loaded until we get response from server?
02) How can we add a custom event for a row which is edited (after edit button is clicked).
03) How can trigger an event when a row is edited? 

Please help us by giving an example for our better understanding. 

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 21 Mar 2013, 08:43 AM
Hello,

I posted my reply in the support ticket on the same topic. For convenience I am pasting it below:

The Grid edit event is triggered when a row enters edit mode so you could use it to execute your logic. If you need to make the request before the Grid enters edit mode then you could:

  1. Bind a custom click handler on the the table for the button on the Grid table.
  2. Stop the event so that the Grid does not put the row in edit mode until your request is completed.
  3. Put the row in edit in the request success callback via the editRow method.
$(function () {
    var grid = $("#grid").data("kendoGrid");
    grid.table.on("click"".k-grid-edit"function (e) {
        var row = $(this).closest("tr"),
            item = grid.dataItem(row);
        $.ajax({
          url: "url",
          .....
          success: function(){
                grid.editRow(row);
          }
        });
        return false;
    });
});


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