flextable - horizontal alignment

1,716 views
Skip to first unread message

romant

unread,
Nov 8, 2007, 9:40:55 AM11/8/07
to Google Web Toolkit
Hi all,
I am not able to center my textbox in a flextable using css, I am
useless probably or I do not know. Could someone write it for me? I
tried to set margin-left:auto and margin-right:auto, but it did not
work in IE 6.

Thanx.

walden

unread,
Nov 8, 2007, 11:39:50 AM11/8/07
to Google Web Toolkit
What CSS selector are you using? You can't center something in a
table; you can center it in a cell. You might need a rule like the
following, although there are pitfalls to this approach:

.my-FlexTable td {
text-align: center;
}

What about using
FlexTable.getCellFormatter().setHorizontalAlignment(...) ?

walden

romant

unread,
Nov 8, 2007, 1:05:36 PM11/8/07
to Google Web Toolkit
Hi man again,
I have added some textboxes and labels using the
flexTable.setWidget(x, y, widget) method. All of them were added in a
column, thus x is still 0. And now want to center all of the added
widgets. That's the situation.
FlexTable.getCellFormatter().setHorizontalAlignment(...) works, but to
use this for every cell it is quite boring and not very elegant.


romant

unread,
Nov 8, 2007, 1:07:27 PM11/8/07
to Google Web Toolkit
And

.my-FlexTable td {
text-align: center;
}

will not work for every browser.

walden

unread,
Nov 8, 2007, 1:57:30 PM11/8/07
to Google Web Toolkit
If they were all added in the same column, then x would vary while y
stayed constant.
What's boring or inelegant about setting the style of a cell while you
are setting its content?
I think you should post your code.

Walden

romant

unread,
Nov 9, 2007, 3:51:23 AM11/9/07
to Google Web Toolkit
Ok you are right probably, I will take the solution you suggest. Thanx.

Reply all
Reply to author
Forward
0 new messages