View Full Version : How to change style from a grid column
dardison
27 Mar 2009, 12:18 PM
Hi,
I was trying to change the style of a grid column header text depending on some pre-render conditions, so that column header text shows in bold font.
So what I did was:
if(f.isKeyPart())
column.setStyle("font-weight: bold");
where f.isKeyPart() is the condition.
but it doesn't work, all columns remains the same, I see no bold column text.
Did I miss something?
TIA.
Daniel
kolli
27 Mar 2009, 2:05 PM
I have been working on changing the color of a few grid columns based on a condition and i tried the same think but it doesnot work.
This is not a good way to do it but i was wrapping html color tags around the name of the column header and it worked.
micgala
30 Mar 2009, 12:09 AM
Hi.
You could try like this:
Define in a css file one entry for your bold text, or anything else you need.
For example, this entry:
.bold-style {
font-weight:bold !important;
}
Then, you can use it in your GridCellRenderer, like this:
if(f.isKeyPart())
config.css = "bold-style";
Hope this helps you.
Regards,
Michel.
kolli
30 Mar 2009, 4:06 AM
for me that is changing the font weight of the text in the cells.
Can you set the font-weight of the header?
dardison
30 Mar 2009, 5:07 AM
Thanks for your answers.
micgala GridCellRenderer is for changing text of each cell not for the header of the column, as kolli mentioned.
At the moment the only way a found of doing this is littering the header text with html markup.
What I did was:
if(f.isKeyPart()){
column.setHeader("<b>"+myColumnText+"</b>");
}else{
column.setHeader(myColumnText);
}
I really don't like it but as kolli mentioned seems to be the only way.
Regards
Daniel
micgala
30 Mar 2009, 5:09 AM
Right...
Sorry for that... I guess I haven't really seen what you really wanted...
I am glad you guys found a workaround, anyway.
Regards,
Michel.
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.