Rakesh
Rakesh

Reputation: 153

Set row style on jquery grid

i m using a jqgrid on asp.net mvc... i have a specific requirement....The data in the grid is list of values that are to be set on each row... and each row has a Date column... While displaying the grid, i want a different row color on sunday and saturday.. while the rest of the rows are white.. How to achieve this in jquery jqgrid?

Upvotes: 0

Views: 2749

Answers (1)

Oleg
Oleg

Reputation: 221997

You can "bring colors" in your grid with respect of setCell method of jqGrid (see this answer as an example) or jQuery.addClass, jQuery.css (see this and this). You should do this after the grid contain is loaded, for example, inside of your loadComplete event handler.

If you want set background-color style on the cell you should understand one small problem. The class 'ui-widget-content' used for every grid row already defines the background-color per background style (!!! not per background-color). So to have effects you should make changes of the background-color style in one from the following ways: 1) just use background: yellow instead of background-color: yellow (see this). 2) remove 'ui-widget-content' class with jQuery.removeClass('ui-widget-content') (see this); 3) change style of the row more explicit like $("#"+rowid)[0].style.backgroundColor = "yellow" (see this as an example). Choose the ways which you prefer.

Upvotes: 2

Related Questions