Hi Luis,
Thanks for contacting Syncfusion Support.
Based on the primary key value, you can sort out the index of them in the current view data of the Grid. Current viewdata can be retrieved using the getCurentViewData method. Refer to the following code example.
|
<input type="button" id="btn">
<div id="Grid"></div>
<script type="text/javascript">
$(function () {
$("#btn").ejButton({
text: "Select Row",
click: function (args) {
var gridObject = $("#Grid").ejGrid("instance");
//get current data
var data = gridObject.getCurrentViewData();
var rec = data.filter(function (e) {
return e.OrderID == 10249;
})[0];
//get index
var inx = data.indexOf(rec);
//select row
gridObject.selectRows(inx);
}
})
$("#Grid").ejGrid({
dataSource: window.gridData,
allowPaging: true,
columns: [
{ field: "OrderID", headerText: "Order ID", isPrimaryKey: true },
. . .
. . .
]
});
});
</script> |
We have prepared a sample that can be referred from the following jsPlayground.
Regards,
Seeni Sakthi Kumar S.