PDA

View Full Version : TableLayout - add setStyleName



jonjanisch
30 Dec 2008, 7:52 AM
When using a Table layout, you can alter the style like this:



TableLayout layout = new TableLayout(2);
layout.setTableStyle("color: red");


...however, I couldn't figure out a way to set the class style on the table element without a hacky solution.



@Override
public boolean layout()
{
boolean val = super.layout();
getElement().getFirstChildElement().setClassName("my-style-here");
return val;
}


It would be nice if I could simply set the style like this:



TableLayout layout = new TableLayout(2);
layout.setTableStyleName("my-style-here");
layout.addTableStyleName("another-style");