修改jQgrid特定行的背景色:
html:
<div id="jqgrid">
<table id=" list"></table>
<div id="pager"></div>
</div>
<table id=" list"></table>
<div id="pager"></div>
</div>
js:
jQuery("#list").jqGrid({
gridComplete:function(){
var rowLength = jQuery("#list").jqGrid('getDataIDs').length;
var column_isQTrue;
for(var i = 1;i <= rowLength; i++){//行id从1开始
column_isQTrue = jQuery("#list").jqGrid('getCell', i, 5);
console.log(column_isQTrue);
if(column_isQTrue == "否"){
console.log(i);
$(" #list .ui-widget-content:eq(" + (i - 1) + ")").css("background", "#FFCCCC");/*不能用$("#" + i ),因选择器优先级颜色会被jQgrid的css文件中. ui-widget-content覆盖*/
}
}
var column_isQTrue;
for(var i = 1;i <= rowLength; i++){//行id从1开始
column_isQTrue = jQuery("#list").jqGrid('getCell', i, 5);
console.log(column_isQTrue);
if(column_isQTrue == "否"){
console.log(i);
$(" #list .ui-widget-content:eq(" + (i - 1) + ")").css("background", "#FFCCCC");/*不能用$("#" + i ),因选择器优先级颜色会被jQgrid的css文件中. ui-widget-content覆盖*/
}
}
}