tags:

views:

196

answers:

1

Hi all,

I want to set the JQGRID row bgcolor depends upon the condition? How to do it? Im using php.

Thanks in advance,

A: 

look at http://stackoverflow.com/questions/2931732/jqgrid-coloring-an-entire-line-in-grid-based-upon-a-cells-value/2936673#2936673. You should examine current row values after data loading (inside of loadComplete for example). For the elements where you want change the background-color you should remove 'ui-widget-content' css class and then add another class which defines the color which you want.

Oleg
afterInsertRow: function(rowid, aData, rowelem) { if (aData.field =='value'){ jQuery("#list1").setCell(rowid,'name','',{color:'red'}); } } The above code change the column text color. want to change the row background color.... {background-color:'red'} is not working.
jerry
Sorry, but do you read my answer http://stackoverflow.com/questions/2931732/jqgrid-coloring-an-entire-line-in-grid-based-upon-a-cells-value/2936673#2936673? To change background color for a row you should **remove 'ui-widget-content' CSS class** for the row before, because 'ui-widget-content' define background image and because of that a simple changing of color how you wrote can not work. Moreover I recommend always use `gridview: true` and make changing of the grid inside of `loadComplete` and NOT inside of `afterInsertRow` is you not want to have less performance.
Oleg
Its working..Thanks u so very much Oleg.. before i misunderstood your answer..sorry.
jerry
Not a problem. You welcome! Only one general recommendation about the usage of the stackoverflow. You asked already 3 questions in stackoverflow. Please look at http://stackoverflow.com/faq#howtoask and conside to mark the answers which really solve your problem as accepted and to vote other helpful answers. This will help other users easy to find the best or the most helpful information on the stackoverflow.
Oleg