tags:

views:

7

answers:

0

hi, i want to apply alternate row colors to jqgrid. For this i called function like this

jQuery1(document).ready(function() {

jQuery1("#list").jqGrid({
    url: 'gridData.aspx?pgName=AdminHome',
    datatype: "json",
    id: "OrderId",
    colNames:  "Order Date", "Order Status"],
    colModel: [{ name: 'OrderDate', index: 'OrderDate', width: 90, align: 'left', sortable: true, sorttype: 'text' },
                   { name: 'StatusName', index: 'StatusName', width: 130, align: 'left', sortable: true, sorttype: 'text' },
         ],
    height: 250,
    width: 450,
    mtype: "GET",
    pager: '#pager',
    rowNum: 10,
    rowList: [10, 20, 30],
    repeatitems: false,
    viewrecords: true,
    sortname: 'OrderId',
    sortorder: "desc",
    gridview: true,

   gridComplete: function() {
    $('#' + "#list" + ' tr:nth-child(even)').addClass("jqgrow evenTableRow");
    $('#' + "#list" + ' tr:nth-child(odd)').addClass("jqgrow oddTableRow"); 
    }
});

list is my jqgrid id.

is this method true. if yes,then where and how to write css classes "jqgrow evenTableRow" and "jqgrow oddTableRow"