Few questions with ListSelect

Hello everyone,

I was playing with Vaadin and made really good progress in a short time.
Really good product.

But now I am facing a few problems where I don not know how to solve them at the moment.

  1. I have some items in my ListSelect Object. Now I want to add some, but only found setItems(Object o) but not addItems(Object o).
  2. As adding is not available I thought to read the list first, and add my new Items to it and then set them all again.

But add is not available and I could not find any method to get all items. Only getSelectedItems is available, not getItems or getAllItems.

Any Idea how to solve it? Btw I am using version 8.

Thank you.

You could keep a List of items outside of the ListSelect, perhaps in a member variable of the class where you’re using the ListSelect. If you have some new items, first add them to the List and then put the List to the ListSelect component with setItems().

-Olli

Hi Olli,

that is also one of my idea but I would also need to re-order the items in the list and at the end I need to get the full list back.
Do you know if there is another Item I could use? Which may support adding, re-ordering and getting all as a list back?

Also I tried to find a method for “select all” but seems that also does not exist.

Thank you.

Hi,

Generally speaking, you should still be able to do all (including selecting all items) of that if you store a List of items outside the ListSelect. You’re free to, for example, sort your own List, after all. As for other Components, you might also want to take a look at Grid (with multiselection enabled) and TwinColSelect.

-Olli