Problem with multiple CellTables on one page

47 views
Skip to first unread message

Pedro Perez

unread,
Sep 13, 2011, 3:50:42 PM9/13/11
to Google Web Toolkit
Hello,

I'm having an issue with 2 CellTables on the same page using the same
CellTableResource. 1st table is defined like this:

CellTableResource resource = GWT.create(CellTableResource.class);
CellTable<DataRecord> table1 = new CellTable<DataRecord>(100,
resource);

where CellTableResource is an interface that extends
CellTable.Resources that successfully maps to our custom css and
styles our first table correctly.

The issue is with table 2, which is defined like this:
CellTable.Resources tableResources =
GWT.create(CellTable.Resources.class);
CellTable<AddressRecord> table2 = new CellTable<AddressRecord>(25,
tableResources);

table2 seems to inherit table1's styling. I was expecting in this case
that table2 would use GWT's stock CellTable styling.

Can someone perhaps show me where I'm wrong/correct my
misunderstanding of how CellTables use Resources? Is there a way to
have multiple cellTables on one page that use different stylings?

One last thing, we are using GWT 2.2. It is difficult for us to
upgrade 2.3 at this point.

Thanks so much for your help,
Pedro

Thomas Broyer

unread,
Sep 13, 2011, 4:34:15 PM9/13/11
to google-we...@googlegroups.com

Sudhakar Abraham

unread,
Sep 14, 2011, 8:40:24 AM9/14/11
to Google Web Toolkit
To avoid this problem, use different resources (like different style
sheets ). I send the code segment.

S. Abraham
www.DataStoreGwt.com

public interface CellTableResources1 extends CellTable.Resources
{
@Source("your_css1.css")
Style cellTableStyle();
}

public interface CellTableResources2 extends CellTable.Resources
{
@Source("Your_css2.css")
Style cellTableStyle();
}

//cell table

CellTableResources firstCss = GWT.create(CellTableResources1.class);
CellTableResources2 secondCss = GWT.create(CellTableResources2.class);
CellTable<Person> table1 = new CellTable<Person>(25, firstCss );
CellTable<Person> table2 = new CellTable<Person>(25, secondCss);

Thomas Broyer

unread,
Sep 14, 2011, 9:12:24 AM9/14/11
to google-we...@googlegroups.com
That's not enough. As I said on the issue tracker (see link in previous message in this thread), you have to create interfaces that extend the Style interface too, otherwise your class names from the two CSS files will have the same obfuscated names.

Pedro Perez

unread,
Sep 16, 2011, 11:45:59 AM9/16/11
to Google Web Toolkit
Thanks for your help... that's the piece I was missing I think...the
last line of extending of the Style interface. I will try it today and
let you know how it goes.

Thanks again for your help!
Reply all
Reply to author
Forward
0 new messages