jquery - Kendo Grid Get the Row you are editing in edit function -


i have have kendo heiarchy grid, need when edit function triggered current row editing , based on row corresponding master row.

my edit function

update: function(e) {      var campaignweek = e.data.models[0]      $.ajax({       type: 'put',       data: {"campaign_week": campaignweek },       url: "/campaign_week",       datatype: 'json',       success: function(data) {         e.success(data);         $(awesomecampaignid.find('td')[4]).text(data.week_total_cost)         $(awesomecampaignid.find('td')[5]).text(data.week_total_impressions)         $(awesomecampaignid.find('td')[6]).text(data.week_total_grps)         },     });   }, 

the data in e:

object {success: function, error: function, data: object} 

the grid:

function campaignweekgrid(e) {    var stationcampaignid = e.data.id      masterrow = e.masterrow    datasource = new kendo.data.datasource({      transport: {                               read: function(e) {          $.ajax({           type: 'get',           url: "/station_campaigns/" + stationcampaignid + "/campaign_weeks",           datatype: 'json',           success: function(data) {               e.success(data);            },         });       },       update: function(e) {         var campaignweek = e.data.models[0]          $.ajax({           type: 'put',           data: {"campaign_week": campaignweek },           url: "/campaign_week",           datatype: 'json',           success: function(data) {             e.success(data);             $(masterrow.find('td')[4]).text(data.week_total_cost)             $(masterrow.find('td')[5]).text(data.week_total_impressions)             $(masterrow.find('td')[6]).text(data.week_total_grps)             },         });       },       parametermap: function(options, operation) {         if (operation !== "read" && options.models) {           return {models: kendo.stringify(options.models)};         }       },     },     batch: true,     filterable: true,     schema: {         model: {           id: "id",           fields: {           date_range: { type: "string", editable: false },           cost: { type: "number" },           impressions: { type: "number" },           cost_per_thousands: { type: "number" },         }                                 }     },   });    $("<div>").appendto(e.detailcell).kendogrid({      datasource: datasource,                                                     height: 500,     resizable: true,     autosync: false,     columns: [       { field: "date_range", title: "week", width: "175" },       { field: "cost", title: "cost" },       { field: "impressions", title: "impressions" },       { field: "cost_per_thousands", title: "grps" },       { command: ["destroy", "edit"], width: "100" },     ],     editable: "inline"                                                  });  } 

i need able replace masterrow variable in update function. need able current row editing , corresponding master row row. have been searching while , can not find solution. appreciated.

in kendo grid can selected row when user clicks button:

// grid edit onclick function $(document).ready(function ()  {     var grid = $("#gridname").data("kendogrid");      $(grid.tbody).on("click", "td", function (e)      {         var row = $(this).closest("tr");         var rowidx = $("tr", grid.tbody).index(row);         selectedrow = rowidx;      }); } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -