Kendo Grid 不会在事件“onchange"中返回 dataItem网格的 [英] Kendo Grid is not returning dataItem in the event "onchange" of grid
问题描述
我的Kendo grid有内联编辑,数据是通过ajax绑定的.
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"));
当我使用 $(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
推荐答案
var cell = this.select();
var dataItem = this.dataItem(cell[0].parentNode);
这是最终对我有用的代码.我在 Ajax() 中绑定数据源,并使用内联编辑模式进行编辑.我的事件是 onChange().噗
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
这篇关于Kendo Grid 不会在事件“onchange"中返回 dataItem网格的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!