Ah, yes, you're right. Start index should be 10 in my example. Its okay then.
On Mon, Dec 17, 2012 at 12:58 PM, Muhammad Gelbana <m.gelb...@gmail.com>wrote: > Isn't the starting index always dividable by rowsPerPage ? > I logged whats happening on my machine: > > prepare(): StartIndex: 0 EndIndex: 4 (I always add 1 to the endIndex > because I'm using JDO and it's range is exclusive at the higher limit) > getRowValue(): Index: 0 StartIndex: 0 RowsPerPage: 5 Index-StartIndex: 0 > Index%RowsPerPage: 0 > getRowValue(): Index: 1 StartIndex: 0 RowsPerPage: 5 Index-StartIndex: 1 > Index%RowsPerPage: 1 > getRowValue(): Index: 2 StartIndex: 0 RowsPerPage: 5 Index-StartIndex: 2 > Index%RowsPerPage: 2 > getRowValue(): Index: 3 StartIndex: 0 RowsPerPage: 5 Index-StartIndex: 3 > Index%RowsPerPage: 3 > getRowValue(): Index: 4 StartIndex: 0 RowsPerPage: 5 Index-StartIndex: 4 > Index%RowsPerPage: 4 > > prepare(): StartIndex: 5 EndIndex: 9 > getRowValue(): Index: 5 StartIndex: 5 RowsPerPage: 5 Index-StartIndex: 0 > Index%RowsPerPage: 0 > getRowValue(): Index: 6 StartIndex: 5 RowsPerPage: 5 Index-StartIndex: 1 > Index%RowsPerPage: 1 > getRowValue(): Index: 7 StartIndex: 5 RowsPerPage: 5 Index-StartIndex: 2 > Index%RowsPerPage: 2 > getRowValue(): Index: 8 StartIndex: 5 RowsPerPage: 5 Index-StartIndex: 3 > Index%RowsPerPage: 3 > getRowValue(): Index: 9 StartIndex: 5 RowsPerPage: 5 Index-StartIndex: 4 > Index%RowsPerPage: 4 > > > On Mon, Dec 17, 2012 at 9:14 AM, Dmitry Gusev <dmitry.gu...@gmail.com > >wrote: > > > No, they're not the same: > > > > index 9 startIndex 9 rowsPerPage 5 index-startIndex 0 > > index%rowsPerPage 4 > > On Mon, Dec 17, 2012 at 4:17 AM, Muhammad Gelbana <m.gelb...@gmail.com > > >wrote: > > > > > I did, they are the same. Although modulating tolerates a glitch I'm > > trying > > > to understand why is it happening. I have 20 rows per page. The thing > is > > > that, sometimes, the passed index to the getRowValue method is like 0, > > > while the startindex is 20 ! > > > > > > On Mon, Dec 17, 2012 at 12:00 AM, Geoff Callender < > > > geoff.callender.jumpst...@gmail.com> wrote: > > > > > > > On 17/12/2012, at 3:10 AM, Muhammad Gelbana wrote: > > > > > > > > > Marvelous ! You deserve a medal or something :D > > > > > Although I know "jumpstart" is a very resourceful project for > > tapestry > > > > > beginners including me, I don't why I keep forgetting about it ! > May > > > be I > > > > > should have it as my homepage instead of google ehehe > > > > > > > > > > About the getRowValue(int) method: > > > > > > > > > > preparedResults.get(index - startIndex); > > > > > > > > > > > > > > > You think this should work too ? > > > > > > > > > > preparedResults.get(index % rowsPerPage); > > > > > > > > > > > > > > > I think both would have the same result. > > > > > > > > Try it. I think you'll find the answer is no. > > > > > > > > > On Sun, Dec 16, 2012 at 2:15 PM, Geoff Callender < > > > > > geoff.callender.jumpst...@gmail.com> wrote: > > > > > > > > > >> Newly added: a working example using GridDataSource here: > > > > >> > > > > >> > > > > >> > > > > > > > > > > http://jumpstart.doublenegative.com.au/jumpstart/examples/tables/griddatasources > > > > >> > > > > >> Cheers, > > > > >> > > > > >> Geoff > > > > >> > > > > >> On 15/12/2012, at 2:46 AM, Lance Java wrote: > > > > >> > > > > >>> Basically, the prepare() method is used to fetch the rows between > > > > >> startIndex > > > > >>> and endIndex in a single batch and cache them. This cache might > be > > a > > > > list > > > > >>> with indexes ranging from 0 to (endIndex - startIndex) > > > > >>> > > > > >>> getRowValue(int index) is then used to retrieve a single entry > from > > > the > > > > >>> batch. This might require you to subtract startIndex from index > to > > > get > > > > a > > > > >>> suitable index into your cached batch of records. > > > > >>> > > > > >>> getAvailableRows() can be a dynamic value over time. Just make > sure > > > you > > > > >>> return null from getRowValue() if the index is out of range (ie a > > row > > > > has > > > > >>> been deleted). > > > > >>> > > > > >>> > > > > >>> > > > > >>> -- > > > > >>> View this message in context: > > > > >> > > > > > > > > > > http://tapestry.1045711.n5.nabble.com/5-3-6-GridDataSource-provided-row-index-to-getRowValue-int-tp5718694p5718727.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 > > > > >>> > > > > >> > > > > >> > > > > >> > > --------------------------------------------------------------------- > > > > >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > > > > >> For additional commands, e-mail: users-h...@tapestry.apache.org > > > > >> > > > > >> > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > > > > For additional commands, e-mail: users-h...@tapestry.apache.org > > > > > > > > > > > > > > > > > > > -- > > Dmitry Gusev > > > > AnjLab Team > > http://anjlab.com > > > -- Dmitry Gusev AnjLab Team http://anjlab.com