asp.net mvc - Kendo UI Grid update event is not firing -


i have kendo ui inline grid. read , populate grid properly. when press edit , changes in column , press update update event not firing. , not calling controller method.

hope can me point out doing wrong here. following grid binding.

    datasource = new kendo.data.datasource({         transport: {              read: function (options) {                 $.ajax({                     type: 'post',                     url: "./getingredients",                     datatype: "json",                     success: function (result) {                         options.success(result);                     }                 });             },              update: function (options) {                 $.ajax({                     type: 'post',                     url: "./updatedata",                     datatype: "json",                     contenttype: "application/json; charset=utf-8"                 });             },             parametermap: function (options, operation) {                 alert('1');                 if (operation !== "read" && options.models) {                     alert('2');                     return { models: kendo.stringify(options.models) };                 }             }         },         batch: true,         pagesize: 20,         schema: {             model: {                 id: "id",                 fields: {                     id: { editable: false, nullable: true },                     division: { type: "string", editable: true, nullable: false },                     groupname: { type: "string", validation: { required: true } },                     categoryname: { type: "string" },                     typename: { type: "string" },                     itemname: { type: "string" }                 }             }         }      });      var grid = $("#grid").kendogrid(    {        datasource: datasource,        height: 430,        scrollable: true,        pageable: true,        navigatable: true,        columns: [        { field: "division", title: "division", width: "80px" },        { field: "groupname", title: "group name", width: "70px" },        { field: "categoryname", title: "category name", width: "110px" },        { field: "typename", title: "type name", width: "100px" },        { field: "itemname", width: "140px" },        { command: ["edit", "destroy"], title: " ", width: "170px" }],        editable: "inline"    }).data("kendogrid"); 

following method in homecontroller.

  [httppost]     public jsonresult getingredients()     {         ingredientdata ingredientdata = new ingredientdata();         ingredientdata.id = 1;         ingredientdata.divisionid = 1;         ingredientdata.division = "division abc";         ingredientdata.groupid = 2;         ingredientdata.groupname = "group -a";         ingredientdata.categoryid = 3;         ingredientdata.categoryname = "category -d";         ingredientdata.foodtypeid = 4;         ingredientdata.typename = "type one";         ingredientdata.itemid = 5;         ingredientdata.itemname = "item one";          return json( ingredientdata , jsonrequestbehavior.allowget);     }   [httppost]     public void updatedata()     {         // logic update data in database.     } 

did realize have batch set true? when in batch mode, have invoke sync on datasource or savechanges in grid definition.

try adding toolbar command invoking savechanges follow:

var grid = $("#grid").kendogrid({     datasource: datasource,     height: 430,     scrollable: true,     pageable: true,     navigatable: true,     toolbar: [ "save" ],     columns: [         { field: "division", title: "division", width: "80px" },         { field: "groupname", title: "group name", width: "70px" },         { field: "categoryname", title: "category name", width: "110px" },         { field: "typename", title: "type name", width: "100px" },         { field: "itemname", width: "140px" },         { command: ["edit", "destroy"], title: " ", width: "170px" }],     editable: "inline" }).data("kendogrid"); 

or remove batch mode.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -