Okay finally figured it out - the view of events that the debugger was showing was a bit misleading. My problem was trying to use getNumberPages in the init method which was returning 1 because createRowList isn't called until onRender.
I couldn't see that due to the way the debugger was displaying my table object (i.e it was calling the getter and creating a rowList pre render) The solution was to determine the pageNumber myself without trying to use the method and setting the calculated pageNumber in the onInit method of the table. Sorted! Damian On Wed, Oct 12, 2011 at 7:10 AM, Damian Penney <[email protected]> wrote: > Hmm - well it's still not working as expected but I think part of the > issue is that inspecting rowList in the debugger was a bit like > looking at Schrodingers cat in that the debugger was calling the > getter for rowList thus populating it. > > However in my table init and at the end of my page init I set the > pagenumber to table.getNumPages -1 and I see it occur in the debugger > but then by the time it gets to onRender and calls createRowList > pageNumber has been reset to zero. Where might this be happening? > > Damian > > > On Tue, Oct 11, 2011 at 10:52 PM, Damian Penney <[email protected]> wrote: >> So this is what I'm seeing as I step through >> >> performOnInit is called which calls onInit in my page class - within onInit >> >> I set the dataprovider via >> >> >> >> pTable.setDataProvider(new PagingDataProvider<pItem>() { >> >> int size = p.size(); >> >> public int size() { >> return size; >> } >> >> public Iterable<PItem> getData() { >> int start = pTable.getFirstRow(); >> >> final int pagedEnd = start + pTable.getPageSize(); >> int end = pagedEnd < this.size ? pagedEnd : size; >> >> return pItems.subList(start, end); >> } >> }); >> >> >> >> setDataProvider then calls setRowList(null) >> >> But at this point I see that rowList is populated with my first page >> of data even though I have a break point on the getdata method (and >> createrowlist) of my pagingdataprovider - when did the rowlist get >> populated? >> >> I'm also overriding the init method of the table where I set the page >> to the last page - the page renders with the paginator showing the >> last page highligted but the dataset shows my first page of data.. >> >> (adding table.onProcess doesn't appear to change anything) >> >> >> Any ideas most welcome - seems as though my debugger is missing >> something, not sure what though. >> >> Thanks, Damian >> >> On Mon, Oct 10, 2011 at 10:30 PM, Damian Penney <[email protected]> wrote: >>> What is the most efficient way to have a table with a paginator >>> initially render the last page of data? >>> >>> I'm trying to call setPageNumber(table.getNumPages()) but the rowlist >>> is already created before I can sneak in. Tried overriding the init >>> method of the table but still no dice. >>> >>> Any pointers appreciated. >>> >>> Thanks, Damian >>> >> >
