Is there a way to present values in the ‘input’ based on the order which they appear in the dropdown selection?
E.g. let’s say we have “Banana”, “Apple”, “Peach”, “Orange” and “Grapefruit”. We select “Apple” and “Peach”, then we also select “Banana”, so to have “Banana”, “Apple”, “Peach” in the ‘input’?
Not currently supported out-of-the-box. But should be doable by copying the selected items, deselecting them, then select them again in order. This is an example
MultipleSelect<String> multipleSelect = new MultipleSelect<>();
List<String> items = Arrays.asList("Jose", "Manolo", "Pedro");
multipleSelect.setItems(items);
multipleSelect.setDisplayAllSelected(true);
multipleSelect.addSelectionListener(e -> {
if (!e.isFromClient()) {
return;
}
TreeSet<String> selectedSet = new TreeSet<>(e.getAllSelectedItems());
multipleSelect.deselectAll();
multipleSelect.select(selectedSet.toArray(new String[selectedSet.size()]
));
});