JQGrid, change row background color based on condition

前端 未结 9 2121
予麋鹿
予麋鹿 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:57

    This pointed me in the right direction but didnt quite work for me with paging. If it helps anyone, the following did work and doesn't use the colModel formatter.

    I needed to apply a red colour to individual cells with outstanding amounts (name:os) in the 9th td on my grid. Datatype was json and I used the loadComplete function which has the data response as its parameter:

    loadComplete: function(data) {
        $.each(data.rows,function(i,item){
            if(data.rows[i].os>0){
                $("#" + data.rows[i].id).find("td").eq(9).css("color", "red");
            }
        });
    },
    

    Got rid of the paging issues I had and works on sorting etc..

    As an aside - I've found the loadComplete function useful for adding in dynamic information like changing the caption texts for search results - probably obvious to many but I'm new to json, jquery and jqgrid

提交回复
热议问题