I am wanting to sort a collection in grails by date I am currently doing the following:
def pics = Picture.findAllByChild(child, [sort: 'dateCreated', order: 'desc'])
pics.add(Post.findAllByPostedToAll(true))
Because I have added more items to the list i need to sort again by dateCreated descending
It doesn’t look like the sort class can do this.
I have tried:
pics.sort(it.dateCreated)
But this is not allowed
the
sortmethod takes a closure argument, so the correct call (with implicit parens) is