I am working on a grails application, in this I have to apply filter box on list.gsp. When I am filtering using following query(in my service) I am getting paginated list :
def clientCriteria = TripOrder.createCriteria()
def searchResults = clientCriteria.list(max: params.max, offset: params.offset, sort: params.sort, order: params.order){
ilike("origin", "${searchFor}%")
}
println searchResults.getTotalCount()
[searchResults: searchResults, searchResultSize: searchResults.getTotalCount()]
But my problem is that when I am using findAll, I am not able to get paginated list, query as follows :
def searchResults = TripOrder.findAll("from TripOrder as t where t.status.status=:status", [status: searchFor], [max: maximum, sort: params.sort, order: params.order])
println searchResults.size()
[searchResults: searchResults, searchResultSize: searchResults.size()]
Note : Because of some reasons I have to use findAll() HQL instead criteria queries.
Above result provide only number of list equal to max instead of provide paginated list.
Please provide me solution for getting paginated list using findAll().
Thanks.