Would someone be able to provide a code snippet of how to programmatically select a row in the Kendo MVC Grid?
We have the value for the ID (a column in the Grid) in a javascript variable. We want to display the matching row in our grid and mark it as selected. I saw the Kendo demos on how to select the row using grid.select(n), where n is the index into the row on the page. But the demo example doesn't solve this problem.
Note, my data contains several thousand rows and my pageSize is limited to 10 rows per page.
@(Html.Kendo().Grid<ReportViewer.Models.EntityModels.tblTreeView>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(c => c.Name).Title("Report Name");
columns.Bound(c => c.Path).Title("Path");
columns.Bound(c => c.Id).Title(string.Empty).Width("200px");
})
.Pageable(pageable => pageable.Refresh(true).PageSizes(true).ButtonCount(3))
.Selectable()
.Events(e => e.Change("showInTree"))
.Sortable(sortable => { sortable.SortMode(GridSortMode.SingleColumn); })
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(p => p.Id))
.Sort(sort => sort.Add("Name").Ascending())
.PageSize(10)
.Read(read => read.Action("ReportsGridRead", "Home"))
)
)
Any help is greatly appreciated.