Skip to content

How to get a selected row data in grid populated via local array source

Problem:

I am trying to get a selected row data in grid populated via local data array source.

I am able to get all row value through this
$('#data1').jqGrid('getRowData')

but if is want to access any specific row it doesn't work
$('#data1').jqGrid('getRowData',1)



Solution:

You need a column named 'id', and pass the 'id' as the 2nd parameter to the constructor
 
$dg = new C_DataGrid($data1, "id", "data1");

Then you can access the row by id

$('#data1').jqGrid('getRowData', rowid)

Feedback and Knowledge Base