I have the exact same problem/question? When I call prepare myself and update my "availableRows" parameter. Once the getAvailableRows run, the parameter is reseted by itself. How to use GridDatasource the correct way?
Franz Amador wrote: > > I'm starting to use Grid to display the paged, sortable results of a > Hibernate query, so I'm implementing GridDataSource. I was dismayed to > see that getAvailableRows gets called before prepare. This means that I > have to run my query twice: once to count the total rows (when > getAvailableRows gets called), and again to do the sorting and get the > correct page (when prepare gets called). > > If, instead, prepare got called first, then I could do the sorting and > page extraction and get the total number of results all in one query (just > add "count(*)" to the columns being returned). You might ask, how can the > system know the page size to ask for when calling prepare if it hasn't > called getAvailableRows first? No problem: just ask for the first full > page and have prepare return the number of rows it actually found. (Or > add a getter for that information.) > > For fast queries, running them twice isn't that great a sin, but for slow > queries, such as in a user-specified search page, running them twice when > you don't really have to seems extravagant to me. > -- View this message in context: http://www.nabble.com/-T5--GridDataSource%3A-why-call-getAvailableRows-before-prepare--tp19616074p26108742.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org