Using a Grails "g:sortableColumn" to sort by the size of a "hasMany" (many to one) property?
is it possible to use the Grails "g:sortableColumn" tag to sort by a domain clas开发者_高级运维s "hasMany" property count?
class Book { hasMany = [authors: User]}
I want to sort all Books by the number of authors with a "g:sortableColumn" tag in my view, but how? Realy not possible?
Thanks and best regards...
not the best solution, but one
http://www.pubbs.net/200904/grails/65695-grails-user-sort-by-one-to-many-count-with-gorm-or-criteria.html
I thought there was a way to do it with criteriaBuilder but I cannot seem to make it work without changing your domain object
精彩评论