问题描述
我的Kendo网格具有内联编辑功能,并且数据通过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'))
时,它将引发错误对象不支持属性或方法'dataItem'"
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(). uffff
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.网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!