Kendo grid dataItem always null

90 Views Asked by At

I have a kendo grid and I am trying to obtain a dataItem from a dataRow, but my dataItem is always null.

This is the code I am using:

var dataGrid = row.find(".k-grid").data("kendoGrid");

var uidValue = "b318f970-79ec-472e-818f-f0d5adb6b5f3";
var dataRow = dataGrid.tbody.find("tr[data-uid='" + uidValue + "']")[0];
                           
                            
var dataItem = dataGrid.dataItem(dataRow);
                           

For testing purposes I manually added the id that I know for sure exists in the DOM. What can be the cause of this issue? I do have to mention that this code is inside an ajax call.

1

There are 1 best solutions below

0
On

Have you tried the getByUid method? Sample code below:

var grid = $("#yourGridID").data("kendoGrid");
var dataSource = grid.dataSource;
var dataItem = dataSource.getByUid(uid);