I am using Ajax binding if that makes any difference, but the view (page) is initially displayed in response to a HTTP Get MVC action. I also tried initializing in the DataBound event, but same problem.
$(document).ready(function () {
// Get a reference to the grid
var grid = $("#Grid").data("kendoGrid");
// Select row if specified
if (dataTypeSelectedGuid) {
// This snippet does not work - grid.select() returns no rows
// AND yes, dataTypeSelectedGuid is correct and valid when
// I look at the HTML.
var guidRowMatch = "tr[data-uid=" + dataTypeSelectedGuid + "]";
var row = grid.tbody.find(guidRowMatch);
grid.select(row);
var select = grid.select();
var dataType = grid.dataItem(select);
// This snippet does work - grid.select() returns first row
// as expected. What gives? What's the difference?
var guidRowMatch1 = ">tr:first";
var row1 = grid.tbody.find(guidRowMatch1);
grid.select(row1);
var select1 = grid.select();
var dataType1 = grid.dataItem(select1);
}
});