jqGrid Coloring an entire line in Grid based upon a cells value

前端 未结 7 1828
难免孤独
难免孤独 2020-12-03 04:05

I know it\'s been asked before, but I cant get it to run and I\'m out of things to try.

I want to colorize a row in a Grid if its value is not 1 - I use a custom for

7条回答
  •  北海茫月
    2020-12-03 04:39

    Assumed other cell value is Y/N.

    below code goes in loadComplete event

     var rowIDs = jQuery("#GRID").getDataIDs();   //Get all grid row IDs 
     for (var i = 0; i < rowIDs.length; i++) {     //enumerate rows in the grid
         var rowData = $("#GRID").jqGrid('getRowData', rowIDs[i]);   
         //If condition is met (update condition as req)
         if (rowData["COLNAME_CHECKED"] == "N") {          
    
             //set cell color if other cell value is matching condition
             $("#GRID").jqGrid('setCell', rowIDs[i], "COLNAMEModified", "", { color: 'red' });
             //for row color, update style. The code is given above by **Ricardo Vieira**
         }
     }
    

提交回复
热议问题