jqGrid - how to find iRow (index of the row) from rowId (table pri key)

15,084

The index of the row (iRow) you can get using rowIndex property of the DOM object which represent ther row <tr>. So you need just get the DOM of the row. If the rowId don't contain any meta-characters you can do just the following

var iRow = $('#' + rowId)[0].rowIndex;

For the more common case you can use jqID function which escapes the meta-characters if needed:

var iRow = $('#' + $.jgrid.jqID(rowId))[0].rowIndex;
Share:
15,084
Onur Eren Elibol
Author by

Onur Eren Elibol

Updated on June 07, 2022

Comments

  • Onur Eren Elibol
    Onur Eren Elibol almost 2 years

    I have rows from a table in jqGrid. I manipulate the behaviour of cellEdit and now use it for editing. After I init the grid, I will use;

    $('#grid').editCell(iRow,1,false);
    

    to just select the cell.

    but I have only rowId not iRow. How can I get iRow from rowId?