Thank you, Erik! Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov
On Wed, Sep 21, 2016 at 2:20 PM, Erik de Hair <[email protected]> wrote: > raised an issue [1] and created a pull request > > [1] https://issues.apache.org/jira/browse/ISIS-1493 > > > > On 09/21/2016 11:58 AM, Martin Grigorov wrote: > >> Good catch! >> >> Please create a Pull Request! >> >> Martin Grigorov >> Wicket Training and Consulting >> https://twitter.com/mtgrigorov >> >> On Wed, Sep 21, 2016 at 11:52 AM, Erik de Hair <[email protected]> wrote: >> >> Hi Martin, >>> >>> It looks like the code on [1] is messing things up. >>> >>> If you replace the method with something like below, it works: >>> >>> private static Ordering<ObjectAdapter> orderingBy(final >>> ObjectAssociation sortProperty, final boolean ascending) { >>> final Ordering<ObjectAdapter> ordering = new >>> Ordering<ObjectAdapter>(){ >>> >>> @Override >>> public int compare(final ObjectAdapter p, final >>> ObjectAdapter >>> q) { >>> final ObjectAdapter pSort = sortProperty.get(p, >>> InteractionInitiatedBy.FRAMEWORK); >>> final ObjectAdapter qSort = sortProperty.get(q, >>> InteractionInitiatedBy.FRAMEWORK); >>> Ordering<ObjectAdapter> naturalOrdering; >>> if(ascending){ >>> naturalOrdering = ORDERING_BY_NATURAL.nullsFirst(); >>> } else { >>> naturalOrdering = ORDERING_BY_NATURAL.reverse(). >>> nullsLast(); >>> // this is the important part to sort the null values correctly >>> } >>> return naturalOrdering.compare(pSort, qSort); >>> } >>> }; >>> return ordering; >>> } >>> >>> Erik >>> >>> [1] https://github.com/apache/isis/blob/3dffc2d96e240982d16131d5 >>> 7d34fc8f54d1292c/core/viewer-wicket-ui/src/main/java/org/ >>> apache/isis/viewer/wicket/ui/components/collectioncontents/a >>> jaxtable/CollectionContentsSortableDataProvider.java#L170 >>> >>> >>> On 09/20/2016 03:43 PM, Martin Grigorov wrote: >>> >>> Hi Erik, >>>> >>>> This should be handled by >>>> https://github.com/apache/isis/blob/3dffc2d96e240982d16131d5 >>>> 7d34fc8f54d1292c/core/viewer-wicket-ui/src/main/java/org/ >>>> apache/isis/viewer/wicket/ui/components/collectioncontents/a >>>> jaxtable/CollectionContentsSortableDataProvider.java#L163-L167 >>>> It looks correct to me. >>>> Put a breakpoint and see what happens. >>>> >>>> Martin Grigorov >>>> Wicket Training and Consulting >>>> https://twitter.com/mtgrigorov >>>> >>>> On Tue, Sep 20, 2016 at 3:30 PM, Erik de Hair <[email protected]> >>>> wrote: >>>> >>>> Hi, >>>> >>>>> This might be a bit off topic but I hope Martin could answer this >>>>> question... >>>>> >>>>> When sorting a table on a column containing (joda LocalDate) null >>>>> values, >>>>> using the Wicket viewer by clicking the header of the column, it always >>>>> keeps the items with null on top even after reversing the sort order. >>>>> Is >>>>> there any way to change this behavior? >>>>> >>>>> Thanks, >>>>> Erik >>>>> >>>>> >>>>> >
