I’m having a Vaadin8-grid containing some Date-Columns. I need to get the grid sorted, so that the null-values of these columns are always at the end of the list, like this example:
(ascending)
- 01.02.2019
- 02.02.2019
- 03.02.2019
- null
- null
(descending)
- 03.02.2019
- 02.02.2019
- 01.02.2019
- null
- null
Sorting is done by clicking on the grid’s column header.
I tried to use
col.setComparator()
and also the Java8-Features like
Comparator.nullsLast()
…and wrapped them in a SerializableComparator.
Result ist always the same: one sorting-direction works fine (e.g. ascending) and as soon as you sort once again (by clicking the header) the null-values are on top of the list. I suppose that Collections.reverseOrder() is used which somehow kicks the Comparator?
Any ideas / suggestions on how to do that?