Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

how to set the cell background color baced on the cell value in 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'});

I want to set the cell background color on table loading, based on the cell values. how to do this?

Thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...