PDA

View Full Version : Setting row color in grid (gwt)



Hansson
9 Nov 2009, 9:17 AM
In this thread i read how to set the background color of the grid. http://www.extjs.com/forum/showthread.php?t=52598

Unfortunately this does not work for the foreground color. It seems that the color style can not be inherited from the <div> to the <table>. I have tried to use and override the GridViewConfig.getRowStyle(...). But the class is only added in the div, and not in the contained table.

How do I solve this in GWT?

Arno.Nyhm
10 Nov 2009, 8:34 AM
maybe you need to add additional div elements to the css path get the inner cell

Arno.Nyhm
10 Nov 2009, 8:36 AM
pls look this threads for more hints:

http://www.extjs.com/forum/showthread.php?t=81139&highlight=x-grid3-cell-inner

Hansson
11 Nov 2009, 6:05 AM
I am noob to css stying, but when i got the meaning of this syntax .classA .classB syntax, i could make my code work as intended :D

here is my code:

snip from java code:


GridView gv = new GridView();
gv.setViewConfig(new GridViewConfig() {
@Override
public String getRowStyle(ModelData model, int rowIndex, ListStore<ModelData> ds) {
if (mybooleanExpression) // this expression is different in my code
return "";
else
return "grayfields";
}
});



snip from css file:


.grayfields {
}

.grayfields .x-grid3-cell-inner {
color: Gray;
}

Arno.Nyhm
11 Nov 2009, 7:00 AM
great! you are welcome :-)

PS: thanks for sharing your solution :-)