javavaadin6

Vaadin 6 . Set table heigth to fit context


I have a Table in my project inside a Panel inside a VerticalLayout and I need to set table height to fit the context. If I set

table.setsizeFull() ;
table.setPageLength(0);

then table height is much smaller than necessary and there are vertical scrollbar.

I tried to do like this:

table.setPageLength(table.getItemIds().size() + 1);
table.requestRepaint();

but in this case there are a lot of space under the table. I tried to set setSizeFull() for all elements but this has no effect. When I tried this:

table.setPageLength(table.getItemIds().size());
table.requestRepaint();

effect was the same, as in first case (smaller height and vertical scrollbar). How can I set table heigth to fit context?


Solution

  • Fixed by this:

    table.setWidth(100, UNITS_PERCENTAGE); 
    table.setHeight(SIZE_UNDEFINED, 0);
    table.setPageLength(0);