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.
Sorting ComboBox items
I would like to sort ComboBox items by caption names. What is the best approach to achieve this? Now I load all items from DB in form of ArrayList, transform it into ListDataProvider and set it in ComboBox.
It would be then prefrable to have the caption names in DataProvider as well. Then you can sort is using addSortOrder(...) method. If you need custom sorting, you need to use custom comparator and add it with addSortComparator(...), you can find further specs here:
https://vaadin.com/api/8.0.5/com/vaadin/data/provider/ListDataProvider.html