How does one programmatically select the top row of a JQGrid. I want to have the top row already selected when it is opened on the page. My grid is sorted by a descriptive column so the first row's id could be any number. I know the method to use I just don't know how to get the rowid for the top (first) row. The method is:
jQuery("#mygrid").setSelection(rowid, true);
By default jqGrid is configured to select a single row. To get the id of the selected row use the following code: var selectedRow = $("#grid_id"). jqGrid('getGridParam', 'selrow');
If the row which you need highlight has the id 123 you can just use setSelection method for selecting: jQuery('#tab_Categorize'). jqGrid('setSelection', '123');
How to get a cell value in JQGrid? var ret = jQuery("#MyGrid"). jqGrid('getRowData', id); ret = ret.
jqGrid exposes a property rowNum where you can set the number of rows to display for each page.
The answer above was close, but the case was off. It should be:
$("#mygrid").getDataIDs()[0];
That should work properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With