I have a Table component inside some layouts and I don't want it to show any scrollbars.
The table will always show only 25 rows, and the width should always be 720px. However, the table keeps showing both vertical and horizontal scrollbars and I cannot figure out how. The funny thing is(although I am rather crying now), that sometimes the scrollbars disappear. When I keep refreshing the page, sometimes they vanish and everything is ok.
Here are couple infos I have collected after hours of debugging:
- Sometimes, the icons/images/etc. aren't loaded and are displayed from cash, sometimes they are. And guess what, this is also switch the scrollbars on and off, although the images are still displayed.
- The width of each column is sometimes couple pixels more - and that's why the horizontal scrollbar shows up and I think that's is also why the vertical scrollbar shows up (because the horizontal takes some pixels from the height of the table)
- I have tried to call requestRepaint after filling the table, even requestRepaintAll on the parent component, and its parent, and its parent, etc...
- I have tried setting the width of each column in percentage. 100000.) I think I have tried all other things between 4 and 100000.
I must be missing something. A lot of people have this problem, and I've found a lot of threads directly on the vaadin page, but there is no THIS-DEFINITELY-WORKS solution.
EDIT CODE:
Table t = new Table();
t.setWidth("720px");
t.setImmediate(true);
t.setSelectable(true);
// Headers
t.addContainerProperty("fullName", String.class, null, "Meno", null, null);
t.setColumnExpandRatio("fullName", 22);
t.addContainerProperty("dateOfBirth", Date.class, null, "Narodenie", null, null);
t.setColumnExpandRatio("dateOfBirth", 18);
t.addContainerProperty("lastYearCosts", BigDecimal.class, null, "Náklady", null, null);
t.setColumnExpandRatio("lastYearCosts", 10);
t.addContainerProperty("lastYearBalance", BigDecimal.class, null, "Saldo", null, null);
t.setColumnExpandRatio("lastYearBalance", 10);
t.addContainerProperty("activeClient", ComparableBooleanEmbeddedIcon.class, null, "", new ThemeResource("icons/icon-app-header-medipartner.png"), Table.ALIGN_CENTER);
t.setColumnExpandRatio("lastYearBalance", 8);
t.addContainerProperty("dmsCount", String.class, null, "", new ThemeResource("icons/icon-app-header-heart.png"), null);
t.setColumnExpandRatio("dmsCount", 8);
t.addContainerProperty("authCount", String.class, null, "", new ThemeResource("icons/icon-app-header-warnings.png"), null);
t.setColumnExpandRatio("authCount", 8);
t.addContainerProperty("book", CssLayout.class, null, "Objednať", null, Table.ALIGN_CENTER);
t.setColumnExpandRatio("book", 16);
Then, I am just filling in rows with addItem(Object[] item).
<div>
with Firebug and share your findings. – Adcock