uladzimir
uladzimir

Reputation: 5689

Pagination on a ArrayList

There are a lot of possibilities to make pagination with domain classes, but what about existing ArrayList of objects?

Is it possible?

Upvotes: 2

Views: 891

Answers (1)

tim_yates
tim_yates

Reputation: 171124

Couldn't you use the standard Grails paginate tag, but in place of:

    [books: Book.list(params), bookCount: Book.count()]

Do something like:

    [books:list.drop(params.int('offset')?:0).take(params.int('max')?:10),
     bookCount: list.size()]

Upvotes: 6

Related Questions