PDA

View Full Version : [GXT 2.0 m3] Pb with setIconStyle



jm.tinghir
16 Jun 2009, 2:47 AM
Hi,
Just upgraded to 2.0-m3 and saw that the setIconStyle method on a Button doesn't add the class to my button element (in the generated Html) anymore.

Button excelButton = new Button();
excelButton.setText(buttonLabel);
excelButton.setIconStyle("excel-button");
It was working with 2.0-m2.

Thanks,
Jean-Marie

sven
16 Jun 2009, 2:50 AM
This is not a bug. I will move this to the help forum. SetIconStyle only sets the icon.

If you want a stylename, you have to use addStyleName

jm.tinghir
16 Jun 2009, 5:11 AM
If you want a stylename, you have to use addStyleName
This doesn't work either.

sven
16 Jun 2009, 5:26 AM
You should probably explain what you are doign with this css rule.

jm.tinghir
16 Jun 2009, 5:45 AM
I recompiled my code -without changing aything- with the 2.0-m2, and both setIconStyle and addStyleName are working.
So I confirm that this seems to be a bug in the 2.0-m3 version.
If I'm wrong, tell me why.

This is what I'm doing :

Button excelButton = new Button();
excelButton.setText(buttonLabel);
excelButton.setIconStyle("excel-button");
excelButton.addSelectionListener(...);
ToolBar toolbar = new ToolBar();
toolbar.add(excelButton);
this.setTopComponent(toolbar);

And whatever I put in my CSS, the excel-button class isn't applied to the button :

<button class="x-btn-text" ...>

Thanks.

sven
16 Jun 2009, 5:50 AM
addStyleName is not appliying anything to the button element. It is applying something to the main element. You need to update your css rules according to that. setIconStyle is only for setting an icon (this was also documented)

jm.tinghir
16 Jun 2009, 5:59 AM
Ok.
My rule was :
button.excel-button {...}I needed to prefix it with button with the 2.0-m2 version, to override other gxt rules, 'cause the class was applied to the button element.
And now -in the 2.0-m3- I agree, not anymore.
Thanks anyway.
Jean-Marie