I have a Table component inside some layouts, and I don't want it to show scrollbars.
Only 25 rows will always be displayed in the table, and the width should always be 720px. However, the table continues to show both vertical and horizontal scrollbars, and I cannot figure out how to do this. The funny thing (although I'm crying now) is that sometimes the scroll bars disappear. When I continue to refresh the page, sometimes they disappear, and everything is in order.
Here are a couple of the information I collected after hours of debugging:
- Sometimes, icons / images / etc. are not loaded and displayed with cash, sometimes they are. And guess what, it also turns scrollbars on and off, although images are still displayed.
- The width of each column sometimes exceeds a couple of pixels - and therefore a horizontal scrollbar appears, and I think it also means that a vertical scrollbar appears (since the horizontal takes several pixels from the height of the table)
- I tried calling requestRepaint after populating the table, even requestRepaintAll on the parent component, and its parent, and its parent, etc.
- I tried to set the width of each column as a percentage. 100000.) I think I tried all other things from 4 to 100000.
Something is missing for me. Many people have this problem, and I found a lot of threads directly on the vaadin page, but THIS DOES NOT WORK.
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 just fill in the lines using the addItem (Object []) element.