In my grid, when the "Add" button on grid toolbar is clicked, a new empty row will be added into grid. Also, all rows will be changed to edit mode.
My problem is that there is an automatic focus on row when it is changed to edit mode. I change the mode of row from the top of grid to the bottom. So the grid always focus to the row on the bottom when the change finishes. But the new empty row is at the top of grid. So user cannot see the new empty in case of there are many rows in grid.
Here is my function to change row to edit mode:
function Grid_EditMode(event, grid) {
var g;
if (grid !== null && grid !== undefined) {
g = grid;
} else {
g = $(this);
}
HideFilterRow(g);
var ids = g.jqGrid('getDataIDs');
for (var i = 0; i < ids.length; i++) {
var cl = ids[i];
g.editRow(cl);
}
g.jqGrid('resetSelection');
$('input[id*=Date]').datepicker();
$('input[id*=Date]').dateEntry({ spinnerImage: '' });
//change button status
$('#pager' + g.attr('id') + " [id*='btnGridAdd']").removeClass('pagerBtn');
$('#pager' + g.attr('id') + " [id*='btnGridEdit']").removeClass('pagerBtn');
$('#pager' + g.attr('id') + " [id*='btnGridDelete']").removeClass('pagerBtn');
$('#pager' + g.attr('id') + " [id*='btnGridReset']").removeClass('pagerBtn');
$('#pager' + g.attr('id') + " [id*='btnGridEdit']").addClass('pagerBtn');
}
Is there any way to disable the focus when changing the row to edit mode?
Note that this problem only occurs on IE, not on chrome. I'm using the jqGrid 4.5.2