FlexTable does not respect Cell Padding

1,166 views
Skip to first unread message

tieTYT

unread,
Oct 18, 2007, 3:17:43 AM10/18/07
to Google Web Toolkit
Hello,

I'm trying to make a FlexTable have 0 padding/margin. That way I can
make rows visible/invisible without the user being able to tell
there's a space there. Unfortunately, it looks like FlexTable does
not respect the 0 padding/margin settings: When I make a row
invisible, you can see extra space between it and the rows above/below
it. This space grows every time you make a row disappear. Here is my
code:

public class MyModule implements EntryPoint {
public void onModuleLoad() {

final FlexTable table = new FlexTable();
for (int i = 0; i < 7; ++i) {
for (int j = 0; j < 3; ++j) {
table.setWidget(i, j, new Button("{" + i + ", " + j +
"}"));
}
}
table.setBorderWidth(0);
table.setCellPadding(0);
table.setCellSpacing(0);

RootPanel.get("slot1").add(table);

Button removeRow = new Button("remove row 1", new
ClickListener() {
private int row = 1;
public void onClick(Widget sender) {
for (int i = 0; i < 3; ++i) {
table.getCellFormatter().setVisible(row, i,
false);
}
row++;
}
});

RootPanel.get("slot2").add(removeRow);
}
}

You may notice there are 4 attempts here to set the FlexTable's
padding to 0. I've also tried setting the Widgets in the cell to
invisible instead of going through the table.getCellFormatter() and it
still has the same effect. I've tried using
table.getFlexCellFormatter().setVisible() instead with no luck. I'm
also using this CSS file:

* {
padding: 0;
margin: 0;
}

This also does not have any effect on the space problem. Note that I
am testing this in hosted mode. Has anyone solved this problem?

Thanks,
Dan

Isaac Truett

unread,
Oct 18, 2007, 8:16:51 AM10/18/07
to Google-We...@googlegroups.com
Use getRowFormatter().setVisible(row, false) instead.

tieTYT

unread,
Oct 18, 2007, 5:24:41 PM10/18/07
to Google Web Toolkit
OK thanks. I'll try this at home. But in the meantime, shouldn't it
be considered a bug that one of these 3 methods do not accomplish this
already:
table.setBorderWidth(0);
table.setCellPadding(0);
table.setCellSpacing(0);

Isaac Truett

unread,
Oct 18, 2007, 7:22:59 PM10/18/07
to Google-We...@googlegroups.com
Only if it's a shortcoming of GWT. I would be inclined to believe it's
a quirk of IE, but I haven't looked into it.


On 10/18/07, tieTYT <tie...@gmail.com> wrote:
>

Reply all
Reply to author
Forward
0 new messages