1
votes

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
Do you want to get the data on editing or once the edit is completed?D_Learning
Sorry by mistake it was mentioned as incell instead it is inline editing . @D_Learning Get Whole row data when any change in any cell of that row (that is onchange event of grid i need to get full data of that particular row).sathwik
I think you will find the below userful: You are looking for change event. You might also been interested on taking a look into this demo showing different grid events. Refernce: stackoverflow.com/questions/14509337/…D_Learning
@D_Learning The Same thing is mentioned in the 3rd point which i have mentioned earlier . In the given sample he is using Single Select as well as multi click to select cell .I cant use this because my client does not want single click selection or double click selectin on row so that approach is ruled out.sathwik
You won't be able to capture the event at the time when cell is being updated, but you can capture the event when the edit button on the Grid for inline editing is clicked. Please let me know if that is what you require, then you just need to specify the below line to get the data row Item " function onChange(e) { var datItem = e.Model; }"D_Learning

1 Answers

0
votes
 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