You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by thomas jaeckle <ma...@gmail.com> on 2007/12/03 11:15:42 UTC

PagingNavigationIncrementLink special behaviour

Hi there.

I implemented a AjaxFallbackDefaultDataTable which has a custom
AjaxNavigationToolbar with a custom AjaxPagingNavigator.
In this AjaxPagingNavigator I want that when the user clicks on ">" (which
is always enabled), more data from a service is loaded:

@Override
public void onClick(AjaxRequestTarget target)
{
   // ">" was clicked and no more pages available -> load more data
   if (increment==1 && isLast())
   {
      getDataProvider().update();
      pageable.setCurrentPage(getPageNumber());
      // pageable.setCurrentPage(getPageNumber()+1); // would throw
IndexOutOfBoundsException
   }
   else
   {
      super.onClick(target);
   }
}

So, this works perfectly, but the page is not changed to the new one,
because of PagingNavigationIncrementLink.getPageNumber() which is final:

   int idx = pageable.getCurrentPage() + increment;
   // make sure the index lies between 0 and the last page
   return Math.max(0, Math.min(pageable.getPageCount() - 1, idx));

It refers on pageable.getPageCount(), which has at this time still the old
amount of pages.

Any idea how to get around this?
Or can PagingNavigationIncrementLink.getPageNumber() be made not-final?


Thomas
-- 
View this message in context: http://www.nabble.com/PagingNavigationIncrementLink-special-behaviour-tf4935583.html#a14127228
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org