如何设置基于jqgrid中的单元格值的单元格背景色? [英] how to set the cell background color baced on the cell value in jqgrid?
问题描述
我正在使用jqgrid.我需要根据这些值设置单元格的背景颜色.
I'm using jqgrid. I need to set background color of the cell based on the values.
重新加载表格后,我尝试使用以下代码禁用颜色.
I have tried using the following code after reload the table the color is disabled.
jQuery(#list").setCell ('5','5','t',{background:'#ff0000'});
jQuery("#list").setCell ('5','5','t',{background:'#ff0000'});
我想基于单元格值在表格加载时设置单元格背景色. 该怎么做?
I want to set the cell background color on table loading, based on the cell values. how to do this?
谢谢.
推荐答案
您可以通过多种方式执行此操作:请参见此或
You can do this in many ways: see this, this or this. Important is not only how you do this, but where. The loadComplete
event handle is the good place for that.
已更新:在下一版本的jqGrid中,您将能够使用新的cellattr
选项作为colModel
中的功能.参见此演示和
UPDATED: In the next version of jqGrid you will able to use new cellattr
option as function in the colModel
. See this demo and my original suggestion.
这篇关于如何设置基于jqgrid中的单元格值的单元格背景色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!