Dynamic Table Layout

Hi Guys,

i need your help.

I am trying to build al Layout with 3 Tables. Under the first and under the last table there should be an button.
At beginning the tables are empty. wenn i add a ne item to the table, the table should grow an “push” the button a little bit more to the bottom of my form.

you understand?

i put a draft to the attachement…

Can i solve the problem with the layout components?

My first idea:
A horizontal Layout with three vertical layouts in it. one vertical for each table…

Thank you and sorry for my bad english :=
12561.png

Don’t know what “items” you want to push into the two outer tables, but I would just use a plain Vaadin-Table and set it’s pageSize according to the number of inserted rows. Thus making it grow as needed.

that sounds very good but what is the comand?

table.setHeight(???)

At the end of the Button.ClickListener, that inserts new Items:

table.setPageSize(table.getContainerDataSource().size());

thank you for your answer but there is no

table.setPageSize(..) 

there is only setPageLength(,,,)

When i try table.setPageLength(table.getContainerDataSource().size()); it works.

now i want also a button in center under the table thats also is dynamic an moves with the table bottom.

You are doing nothing wrong, setPageLength() is the correct method; I just remembered the name wrong.

I didn’t get that, sorry.

sorry for my bad english

but i solved the problem.


HorizontalLayout horLayout = new HorizontalLayout();
VerticalLayout verLayout = new VerticalLayout();

tbl_src = new Table();
verLayout.addComponent(tbl_src);

Button btn = new Button("add");
verLayout.addComponent(btn);

verLayout.setComponentAlignment(btn, Alignment.TOP_CENTER);
...
table.setPageLength(table.getContainerDataSource().size());

so i´ve got a button under the table. and when i add an item to the table so the table get bigger. and the button is always under the table.
thats how i need it… :slight_smile:

thank you