You need to add ItemSorter to the container used by the table; two types of containers expose #setItemSorter - IndexedContainer and AbstractBeanContainer. The default container for a Vaadin table is an IndexedContainer.
The following snippet should add an ItemCorter to the table.
Container container = table.getContainerDataSource();
if (container instanceof IndexedContainer) {
((IndexedContainer) container).setItemSorter(itemSorter);
} else if (container instanceof AbstractBeanContainer){
((AbstractBeanContainer) container).setItemSorter(itemSorter);
}
source
share