我想通过某个列值获取 jqgrid 行 ID。
示例:我有一个名为“example_id”的列,并且我需要 jqgrid 行 ID,因为该列是随机的“example_id”。那可能吗?
注意:我不是点击表格,是url传递的参数
我想通过某个列值获取 jqgrid 行 ID。
示例:我有一个名为“example_id”的列,并且我需要 jqgrid 行 ID,因为该列是随机的“example_id”。那可能吗?
注意:我不是点击表格,是url传递的参数
I suppose that you fill jqGrid data in not full correct way. You wrote about "row index" instead of rowid. So I suppose that you don't specified id
or rows in your input data. jqGrid need always assign unique value of id
attribute of every row of grid (the id
of <tr>
elements). Because of "must to have" character of the information jqGrid have to assign some values like 1, 2, 3 as rowids. If your grid have column example_id
with native unique information I would recommend you to use key: true
property in the definition of the column in colModel
. In the case jqGrid will use the value from the column to assign id
attribute of rows of the grid. So you can solve your problem in the way.
Alternatively you can use getCol method to get array of items like {id:rowid, value:cellvalue}
where value
property contain the value from example_id
column and id
contains the corresponding rowid. In the way you will . Using $.map method you can easy analyse the array and get the ids of rows which contains some specific value in example_id
column.