Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to programmatically select top row of JQGrid?

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);
like image 417
MikeD Avatar asked Nov 23 '09 21:11

MikeD


People also ask

How do I select rows in jqGrid?

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');

How do I highlight a row in jqGrid?

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 do I get the value of a jqGrid cell?

How to get a cell value in JQGrid? var ret = jQuery("#MyGrid"). jqGrid('getRowData', id); ret = ret.

What is rowNum in jqGrid?

jqGrid exposes a property rowNum where you can set the number of rows to display for each page.


1 Answers

The answer above was close, but the case was off. It should be:

$("#mygrid").getDataIDs()[0];

That should work properly.

like image 180
rbdrbd Avatar answered Oct 16 '22 13:10

rbdrbd