views:

632

answers:

1

How can I set the background-color of an entire row (not just cell) using the custom formatter?

A: 

The custom formatters are used for formatting the cell's data (= text). As far as I know they don't know about the actual cell (meaning a jquery object) but only of it's value.

But usually jqGrid assigns IDs to all rows so setting the background color if you know the rows ID should be only a matter of setting the background color of all td child elements of this row.

$(rowid).children("td").css('background-color', "#5E5E5E");
Daff
Just curious, have you tried integrating this with a jQuery UI Theme, so the background colors are picked from the theme?
Justin Ethier
Hm I don't know about any jQuery UI classes that could do that (as far as I know there are only .ui-state-highlight and .ui-state-error that normally have a distinct color). But it would make sense to create additional CSS classes that contain the color information.
Daff