Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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');
like image 673
user957863 Avatar asked Dec 13 '11 15:12

user957863


1 Answers

try this:

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

 }
like image 126
dllhell Avatar answered Oct 20 '22 12:10

dllhell