你是对的,你不是第一个提出这个问题的人。用我制作的单元格颜色清除情况the demo
为您以不同方式更改单元格的文本颜色或销售的背景颜色:
loadComplete: function() {
// 2 is zero-base index of the column 'name' ('Client'). Every from the options
// multiselect:true, rownumbers:true and subGrid:true will increase
// the index by 1 because the option inserts additional columns
$("#6 td:eq(2)", grid[0]).css({color:'red'});
grid.jqGrid('setCell',"12","name","",{color:'red'});
grid.jqGrid('setCell',"10",'name', '', 'my-highlight');
grid.jqGrid('setCell',"8",'name', '', 'ui-state-error ui-state-error-text');
grid.jqGrid('setCell',"4","name","",{'background-color':'yellow',
'background-image':'none'});
grid.jqGrid('setCell',"3","name","",'ui-state-highlight');
}
在哪里
<style type="text/css">
.my-highlight { color: red; }
</style>
“3”、“4”、“6”、“8”、“10”和“12”是对应列颜色会发生变化的行的第throwid。
顺便说一句,我个人最喜欢的是使用“ui-state-highlight”或“ui-state-error ui-state-error-text”类的方法,它们是jQuery UI Themes 的一部分。
更新:为了了解在使用另一个 jQuery UI 主题的情况下不同方法的使用差异,我添加了 one more demo 使用了 La Frog 主题,其中与上面相同的表格看起来像以下: