Dnia 2009-06-24, śro o godzinie 12:19 -0300, Thiago H. de Paula Figueiredo pisze: > > Why Grid#setupDataSource() is calculating endIndex and not allowing for > > GridDataSource to do it? Why GridDataSource#prepare method have > > startIndex and endIndex parameters and not offset/limit pair? > > As offset = startIndex and limit = endIndex - startIndex + 1, I think > their interchangeable for most scenarios. > > > I'm asking, because if GridDataSource could calculate endIndex (or use > > limit instead) for itself, then there would be no need to call > > getAvailableRows() before prepare(), which is a problem (at least IMHO). > > I guess getAvailableRows() is used for calculating the number of pages > and then display the pager. When pager is used, then GDS#prepare() was already called, so getAvaialbleRows() can return correct value.
My point is that the current implementation of Grid#setupDataSource() uses getAvailableRows() to calculate exact values for start and end indices. Shouldn't this be responsibility of GridDataSource? Grid#setupDataSource() could pass just "logical" (exact available rows would be calculated by GDS) values calculated as I wrote in previous post. IMHO this would also allow for GDS to handle rows deletions for itself. > > > This would allow for single-call (those which receive number of > > available rows, columns definitions, and columns values in one expensive > > call) datasources to work. > > Please file a JIRA about this. Maybe we could use some special return > value in GridDataSource.getAvailableRows() to indicate that it is not > available yet and then call it again after GridDataSource.prepare(), > thus solving your problem. IMHO there is no need for special value. It's just matter of the current implementation of Grid#setupDataSource(). For now, to make Grid working with single-call GridDataSource, I had to copy Grid.java only to replace setupDataSource(). Best regards, Przemysław Wojnowski --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org