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 clientes = new ArrayList();
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 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 :slight_smile:

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