I've got a jqGrid that I'd like to have the first row selected when the page loads. I've found a couple different approaches, but none of them seem to work for me. The data is coming over an ajax call, so as far as I can tell the grid is attempting to select the first row before any data has been loaded.
var reqListGrid = new BaseGrid("#request_list");
reqListGrid.edit_url = '...'
reqListGrid.name = 'Request List'
reqListGrid.colNames = ["Employee", "Code", "Start Date", "Submitted", "Hours"]
reqListGrid.height = '200px';
reqListGrid.width = 'auto';
reqListGrid.colModel = [
{name:'req_emp', ...},
{name:'req_code', ...},
...
];
reqListGrid.gridComplete = function(){
var req_top_row = $("#request_list").getDataIDs()[0];
$("#request_list").setSelection(req_top_row, true);
};
reqListGrid.createGrid();
I've set a breakpoint in the gridComplete method, but Chrome never hits it. Any tips?