Populating RHS of TwinColSelect

Hello all,

I am new to Vaadin, and I have a question about TwinColSelect.

  1. Can RHS of TwinColSelect be populated when it’s created only? By that, I mean could I use setValue (or something else) somewhere else (including from different class)
    the creation of TwinColSelect to set its RHS value?

The reason why I am asking the question above is due to the restriction I have on my project. In this project, I bind TwinColSelect to a bean using BeanFieldGroup. Then, I have no problem saving its content to a DB. However, I also must be able to fetch those values from DB, then use them to populate TwinColSelect’s RHS so that its selections can be modified.

The problem is that when retrieving data from DB, my TwinColSelect is created without any data first, then its RHS must be filled later in a different method in which the bean containing fetched data from db is set. I know this may make you guys ask “why don’t you just fetch the bean upon creation of TwinColSelect?” but it’s the restriction of the project at the moment.

I’d appreciate if you could help me out.

Thank you.

Are you talking about adding Items to a TwinColSelect?

In that case you can use TwinColSelect.addItem(itemid) (See this example in the vaadin sampler
Click on the Source button in the upper right corner
Or this book of vaadin link:

If you want to select some value while populating it i’m guessing there is some method like TwinColSelect.select(itemID) to do this (JavaDoc AbstractSelect