Hi,
I have grid with more than 100 records. I want to edit a record. so I have used filter or manually went to that page (say 5th page) and clicked edit or view. My edit and view buttons are custom buttons where it takes to another page. when i click save or cancel on edit or view pages, it will navigate to page where i have grid. The grid is by default selecting the first record. But i want to retain the filter or page number where the record is and should go to that page automatically. If it is in first page i am doing it on data bind, manually selecting the record and it is working fine. If the record is in the 5th page or so , I am selecting the record but the grid is going to default to first page.
function grid_dataBinding(e) {
var grid = this;
var count = 0;
var value = $("#myDiv").data('value');
if (value > 0) {
$.each(grid.tbody.find('tr'), function () {
var model = grid.dataItem(this);
if (model.id == value) {//some condition
$('[data-uid=' + model.uid + ']').addClass('k-state-selected');
count++;
return;
}
});
}
// If i dont have any selected id, I am defaulting it to first record
else {
this.element.find('tbody tr:first').addClass('k-state-selected');
}
// If i dont find the selected id in the grid am defaulting it to first record
if (count == 0)
this.element.find('tbody tr:first').addClass('k-state-selected');
}