How to navigate page with Vaadin menubar?

1.7k views Asked by At

These are my first steps with java, I took grails and vaadin plugin. I want to make simple app with menu bar navigation, so I have got some Vaadin example: http://demo.vaadin.com/sampler-for-vaadin6#BasicMenuBar

created some commands:

edit.addItem("Cut1", menuCommand1);
edit.addItem("Cut1", menuCommand1);

Each command just draw table from another example:

http://demo.vaadin.com/sampler-for-vaadin6#TableHeaderIcons

Unfortunately each time I hit menu item it draws one table under another table, but what I was expecting is to draw each table in place of previous one. How to achieve this?

1

There are 1 answers

5
cfrick On BEST ANSWER

vaadin's UI is stored as state (in a session) on the server. if you add several items they stay unless removed. so e.g. if you want to replace the table there you two options. either removeAllComponents and then add the new one or if you have hold of the original table then you can replaceComponent in the wrapping layout (most likely a VerticalLayout?).

if the table is just supposed to change content, then you are better off to just change/modifiy the dataSource of the table.