PDA

View Full Version : Apply style from CSS file to ColumnConfig



chompy18
14 Dec 2011, 3:47 AM
Hi.

I am trying to set a CSS Style from an external CSS file to the Grid's ColumnConfig.
I have managed to apply style to column using:
priceCC.setStyle("text-align: right; width:8em;");

This works since setStyle expects a string or css style.

But I don't want to have the style explicitly defined in code. I want to have if defined in CSS file and reference it to the ColumnConfig.

How can this be done?

Thanks,
Sefi

Sefi Ninio
14 Dec 2011, 11:49 PM
Anyone tried this?
I am surprised no one has run into this...

bogusky
19 Dec 2011, 1:19 AM
every grid's column has built-in style with column id in the end.
you can add style for grid for exact one grid to match.


ColumnConfig column = new ColumnConfig();
column.setId("my_id");
Grid grid = new Grid();
grid.addStyleName("my-grid");

column will have style "x-grid3-col-my_id"

You can use style name ".my-grid .x-grid3-col-my_id {color: red;}"
use firebug, it is very helpful.