'What is the replacement for ListSelect in Vaadin 22?

I'm trying to update an application from Vaadin 7/8 to Vaadin 22.

ListSelect is gone, so I need a new widget field that satisfies these requirements:

  1. Allows choosing multiple items
  2. Suitable for use in FormLayout with value bound using Binder
  3. Scrolls automatically when there are more than a handful of choices

None of the widgets in Vaadin 22 seem to qualify:

  • Select and ComboBox only choose one item
  • ListBox says ...designed to be used as a lightweight scrollable selection list rather than a form input field
  • Grid does not implement HasValue so can't be used with Binder
  • CheckBoxGroup doesn't look like it will scroll (requirement #3) (I haven't actually tried yet though)

What am I missing here?? What is the new equivalent of the old ListSelect?



Solution 1:[1]

If your Grid is set to multiselect mode, you can use grid.asMultiSelect() to return a MultiSelect object that does implement HasValue and can be used with Binder. Similarly, in single-select mode, grid.asSingleSelect() returns a bindable SingleSelect object.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ollitietavainen