PDA

View Full Version : Foreground color on BufferView in Gxt Grid



elirov
14 Aug 2009, 7:25 AM
It looks like only background css styles are applied on rows in a GXT table, when using BufferView.
If you try to do this:

grid.getView().setViewConfig(new GridViewConfig() {
@Override
public String getRowStyle(ModelData model, int rowIndex, ListStore<ModelData> ds) {
return "my-foreground-row-style";
....

then the foreground colors do not take effect even though the background colors do.
I've modified the code at line 254 to:

String viewConfigRowStyle = viewConfig.getRowStyle(model, rowIndex, ds);
buf.append("<table class=\"x-grid3-row-table " + viewConfigRowStyle + "\" border=0 cellspacing=0 cellpadding=0 style=\"");

And it seems to work now. I guess the css was being applied to the DIV instead of the table, so it was being overridden at the table level.

I added the first line so that viewConfig.getRowStyle(model, rowIndex, ds) wouldn't get called more than once.

Erez

sven
14 Aug 2009, 8:52 AM
This is more a help request or i am wrong? Please read the bugforum guidelines. You should try to inspect the element with css to find out why some rules are not overrident. Probably you are missing the !important flag.

elirov
14 Aug 2009, 9:08 AM
Sorry Sven, I figured this was a bug with the code.

I did inspect the element, and the "div" has the right CSS class on it, but the "table" doesn't, and I guess the "table" class has a black color style on the fonts, so it overrides even if the !important flag is on. I tried it with that flag, and it doesn't work.

Using the modifications above, it does work, so I figured that the CSS class needs to be on the "table" and not the surrounding "div".

Erez

sven
14 Aug 2009, 9:11 AM
This is not really a bug. If the class gets assigned to the div, than it is correct.

-edit-

Ok the style was not assgined correctly to the div. This was already reported before and is fixed in SVN.