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.
IndexedContainter with custom ItemSorter for just one
Hi,
How can I implement in ItemSorter that the specyfic sorting will apply only to one of the ItemId of the IndexContainer not for the whole type of data (i.e. String). The reason is IndexedContainer set to FilterTable will have then costom sort method not a default. As far as I know the
public int compare(Object o1, Object o2) {
}
of ItemSorter has to be modifed but how can I figure out that the o1 and o2 coming from specific Id of IndexedContainer?
Thanks
Julian
The idea is that you would create your own ItemSorter class by extending this interface class. I.e. MyItemSorter extends ItemSorter.
Then you can override compare with your own method
@Override
public int compare(MyObject o1, MyObject o2) {
}
The parameters for the ItemSorter compare() method must always be item ids which exist in the container set using #setSortProperties(Sortable, Object[], boolean[]).
After done, set ItemSorter in IndexedContainer using setItemSorter(myItemSorter), where myItemSorter is instance of MyItemSorter.
Br. Tatu