JQGrid, change row background color based on condition

前端 未结 9 2119
予麋鹿
予麋鹿 2020-12-24 02:22

I have the following jqgrid that uses the jquery ui theme imported to my master page.

  $(\"#shippingscheduletable\").jqGrid({
            url: $(\"#shipping         


        
9条回答
  •  醉话见心
    2020-12-24 02:51

     loadComplete: function() {
        var ids = $(this).jqGrid("getDataIDs"), l = ids.length, i, rowid, status;
            for (i = 0; i < l; i++) {
            rowid = ids[i];
        // get data from some column "ColumnName"
            varColumnName= $(this).jqGrid("getCell", rowid, "ColumnName");
        // or get data from some 
        //var rowData = $(this).jqGrid("getRowData', rowid);
    
        // now you can set css on the row with some
            if (varColumnName=== condition) {
                $('#' + $.jgrid.jqID(rowid)).addClass('myAltRowClass');
             }
        }
    },
    

提交回复
热议问题