Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jqGrid row alternating background

Tags:

jquery

jqgrid

How can I insert alternating row background color in jqGrid?

like image 823
Yan Avatar asked Nov 22 '09 07:11

Yan


2 Answers

Look at the altRows and altclass options. Beware of the typically inconsistent capitalization! This does use the jQuery UI theme if you're using jqGrid 3.5 or higher.

like image 188
Craig Stuntz Avatar answered Oct 23 '22 08:10

Craig Stuntz


To use the jQuery UI theme use this code:

$('#'+gridName+' tr:nth-child(even)').removeClass("ui-priority-secondary");
$('#'+gridName+' tr:nth-child(odd)').addClass("ui-priority-secondary");

I use this code when I perform manual sorting (drag-n-drop)

like image 38
Pete Amundson Avatar answered Oct 23 '22 08:10

Pete Amundson