JQGrid, change row background color based on condition

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

    I used the a simple JQuery selector and applied my wanted styles. All you need is the uid (rowid) of the row you wish to apply the styles to.

    if (!xCostCenter[i].saveSuccessful)
    {  
        $("#row" + _updatedRowIDs[i] + "jqxgrid > div").css({ "background-color": "rgb(246, 119, 119)" });
    }
    

    In my case I wanted to change the color of rows that were not saved to change to a red color. To remove the color just execute the following.

    $("#contenttablejqxgrid > div > div").css({ "background-color": "" });
    

    hope this helps someone.

提交回复
热议问题