How to add to a table from a combo box?

I have a combo box of all possible values, and I want to add the user’s single selections to a table. I can tell that my listener on the combo box is working, but doing an additem to my table’s container doesn’t make the item show in the table. I think I have the container and table linked, but can’t tell for sure either, ( Blury eyes :bored: )

I’ve dug around for a while, but all the examples seem to use pre-populated tables, and I am populating on the fly.

Any comments/hints would be appreciated.

BTW - I think Vaadin is much better than WaveMaker. I’ve gotten a lot farther in 1 week than 1 month trying WM…

Thanks…

I guess you will have to use the table.setContainer method to repopulated the table.

You do not need to change the data source to update the table, it is enough to update the contents of the data source and the Table should be updated automatically.

As always there are many things that can go wrong:

  • If you are unsure if you are updating the correct data source, check it using a breakpoint. Alternatively use Table.addItem or table.getContainerDataSource().addItem().
  • Make sure you are calling the correct addItem. addItem(itemId) requires itemId to be unique, if it is not the item won’t be added (null returned)
  • If you are using IndexedContainer you must update the properties for the newly added row. Otherwise you will just get an empty row.
  • Probably many more…

My best bet would be (if you don’t directly spot the error) to run the project in debug mode and see what you actually are doing and where it goes wrong.

It was item 2. Thanks for the fresh info. :lol: