Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
ComboBoxMultiselect SORT
How I can change sort in the ComboBoxMultiselect?
public class Client(){
private Long id;
private String name;
....
//maybe
@Override
public String toString() {
return this.getId() + " - " + this.getName();
}
}
List<Client> clientes = new ArrayList<Client>();
list.add(new Client(1L, "Java"));
list.add(new Client(2L, "Bonprix"));
list.add(new Client(10L, "Addon"));
list.add(new Client(20L, "Addon"));
list.add(new Client(21L, "Addon"));
list.add(new Client(100L, "Addon"));
list.add(new Client(101L, "Addon"));
BeanItemContainer<Client> container = new BeanItemContainer<>(Client.class);
container.addAll(clientes);
container.sort(new Object { "id" }, new boolean { true });
combobox.setContainerDataSource(container);
or
combobox.addItems(clientes);
1
10
100
101
11
2
20
21
Adding an own comparator is now available in version 1.1.4 :)
use setComparator(...) and you can use the getSelectedValueOrder(Object o1, Object o2) from the ComboBox itself to get a regular sorting of the selected and unselected items.
btw sorry for the late responds time...
Please I nead more help. I know that you have give answer for the sort "problem" but for me it wasn't clear.
Simple I am using BeanIteamContainer like your example and i don't want any sort. How can i do this?
And also how can i get the selected values of the combo.
Thanks again for this great Component.
Rgds
Elias
any solution? i'm still unable to sort items even when my bean container is sorted