0
我有一個ComboBox
並提供數據與BeanItemContainer
。我還附加一個分揀機進行默認分揀。但結果始終未排序。爲什麼?如何在Vaadin中對ComboBox進行排序?
public class Car {
private String name;
}
private ComboBox box = new ComboBox("sorted cars");
BeanItemContainer<Car> cont = new BeanItemContainer<>(Car.class);
//cont.addItem();...
System.out.prinltn(cont.getSortableContainerPropertyIds()); //prints: [name]
box.setItemSorter(new DefaultItemSorter());
box.sort(new Object[] {"name"}, new boolean[] {true});
box.setContainerDataSource(cont);