user957863
user957863

Reputation: 325

jqGrid how do you loop through the grid?

I have a project that uses jquery's jqgrid. How do I loop through the grid rows and get to a value?

somethign like

var rows = $(#mygrid).rows
foreach(row in rows)
    alert(row["firstName"])

I have even seen something like this, but no examples of what to do with it.

var rows = $('#grid').jqGrid('getCol','firstName');

Upvotes: 7

Views: 20402

Answers (1)

dllhell
dllhell

Reputation: 2014

try this:

var rows = jQuery("#grid").getDataIDs();
 for(a=0;a<rows.length;a++)
 {
    row=jQuery("#grid").getRowData(rows[a]);
    row.colname1; row.colname2; 

 }

Upvotes: 15

Related Questions