:: Forum >>

Apply a background color to a column?

I would like to be able to apply a color to a column programatically, something like:
(prototypejs)

$$("#IDayLostGrid1 .aw-column-6").each( function(iter) {
iter.setStyle({backgroundColor: "red"});
});

Which kind of works even if it's far from the correct way (scrolling the grid seems to lose the style). I figured there would be a column template to get a hold of, but there doesn't seem to be.

Also, I'm on 2.0.1

Garren
Monday, December 14, 2009
Actually it's not quite what I'd posted above, I'd like to be able to add a class name to a column as opposed to adding individual rules.

Basically I'd like to be able to highlight number of columns that a user has indicated for some reason (usually to visually indicate required data). I'm constrained by the fact that I need the grid behave the same way that a similar grid in an older application does (hence highlight the whole column instead of just, say, the header.)

Thanks
Garren
Monday, December 14, 2009
The grid does not have column elements (only rows and cells). So you have to work with a set of cells.

You can assign a class with setClass method -

http://www.activewidgets.com/aw.system.html/setclass.html

grid.getCellTemplate(6).setClass('mycolumn', 'selected');
grid.refresh();

Alternatively you can use existing classes (i.e. aw-column-6) and dynamically add/remove style rules in the stylesheet.
Alex (ActiveWidgets)
Tuesday, December 15, 2009

This topic is archived.


Back to support forum

Forum search