FlexTable and UiBinder

171 views
Skip to first unread message

Guenther Starnberger

unread,
Mar 16, 2010, 5:24:44 AM3/16/10
to Google Web Toolkit
I'm currently working on an UiBinder based application, where I'd like
to use a FlexTable to hold data for a form (the labels plus the text
boxes). Unfortunately, it seems that UiBinder does only allow to
declare the FlexTable, but not the elements of the FlexTable. As there
are quite a lot of elements, I'd like to decleare them in UiBinder too
(otherwise it would not make sense to use UiBinder in my application).

What's the suggested way to do this?

In an older post I read the suggestion to add the widgets at some
other place in the UiBinder XML file and then to programmatically
"move" them to the right place in FlexTable. That's what I currently
do: I add the widgets to a HorizontalPanel in UiBinder, then in
onModuleLoad() I manually use FlexTable.setWidget() to move them to
the FlexTable. Afterwards, I delete the HorizontalPanel as it's not
required anymore.

Is there currently a "better" or a "cleaner" way to do this? Or is
this type of solution currently the best option? Are there any other
tables that offer functionality similar to FlexTable and that I can
declare in UiBinder (I need labels and text boxes vertically aligned,
each in multiple columns. Additionally, some of the rows have colspan
larger than one.)?

- Guenther

Paul Stockley

unread,
Mar 16, 2010, 7:47:49 AM3/16/10
to Google Web Toolkit
Why not use a HTML panel and inside define a HTML table with the
widgets in the cells? I rarely use things like FlexTable,
HorizontalPanel or VerticalPanel. Usually all my forms are a
combination of pure HTML and widgets. If you don't need IE6 support
then I can show you some neater ways of laying out forms without
tables.

Guenther Starnberger

unread,
Mar 16, 2010, 3:07:48 PM3/16/10
to Google Web Toolkit

My main reason for using FlexTable was that I need to dynamically add
and remove rows and that this is somewhat simpler using FlexTable's
insertRow() and removeRow() methods.

But I'll have a look at HTML tables, I guess it shouldn't be to hard
reimplementing this functionality via direct DOM access.

- Guenther

Paul Stockley

unread,
Mar 16, 2010, 3:38:43 PM3/16/10
to Google Web Toolkit
If you need to dynamically modify the table I would stay with
FlexTable. Working with the DOM on tables is kind of messy.
Reply all
Reply to author
Forward
0 new messages