Kendo Grid is not returning dataItem in the event “onchange” of grid

丶灬走出姿态 提交于 2020-01-14 04:35:06

问题


My Kendo grid has inline editing, and data is bound through ajax.

I have tried different options like:

1)

var grid = $("#Grid").data("kendoGrid"); 
var row = $(this).closest("tr");
var rowIdx = $("tr", grid.tbody).index(row);
var item =grid.dataItem(row)

2)

var row = $(this).closest("tr");
var grid = $("#Grid").data("kendoGrid");
var item = grid.dataItem(row);

3)

var selectedItem = this.dataItem(this.select()); -- I can't use this because my client does not want single click selection or double click selection on row so this is ruled out

4)

var dataItem = this.dataItem($(e.currentTarget).closest("tr")); 

When I use $(this).dataItem($(e.currentTarget).closest('tr')), it is throwing the error "Object doesn't support property or method 'dataItem'"

Can you please let me know any other way to get data item from kendo grid


回答1:


 var cell = this.select();

 var dataItem = this.dataItem(cell[0].parentNode);

this is the code that finally worked for me. I am binding the datasource in Ajax() , and I edit with Inline edit mode. My event is onChange(). uffff



来源:https://stackoverflow.com/questions/24610029/kendo-grid-is-not-returning-dataitem-in-the-event-onchange-of-grid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!