You are using an static model, which only knows about the value by the time
of construction. Use a dynamic model

i.e: (make sure you define pagination as final)

 Label currentPage = new Label("currentPage", new LoadableDetachableModel(){
 public Object load(){

                 return pagination.getPageable().getCurrentPage();
    }

});


On Tue, Nov 9, 2010 at 1:04 PM, vp143 [via Apache Wicket] <
ml-node+3034524-366758351-65...@n4.nabble.com<ml-node%2b3034524-366758351-65...@n4.nabble.com>
> wrote:

> Hi all,
>
> For some reason I cannot get the current page number. This is the relevant
> part of my code:
>
>
>
> PageableListView dataList = new PageableListView("dataList", results, 10) {
>
>
>             protected void populateItem(ListItem item) {
>
>                         ..
>
> }
>
>             }
>
>
>
>         AjaxPagingNavigator pagination = new
> AjaxPagingNavigator("navigator", dataList);
>
>         add(pagination);
>
>
>
>         Label currentPage = new Label("currentPage",
> pagination.getPageable().getCurrentPage() + "");
>
>         currentPage.setOutputMarkupId(true);
>
>         add(currentPage);
>
>
>
> currentPage always returns 0.
>
> I have also tried PagingNavigator with similar results.
>
>
>
> Can anyone tell me what I have missed?
>
>
>
> Regards
>
>
>
> Vishal
>
>
>
> ------------------------------
>  View message @
> http://apache-wicket.1842946.n4.nabble.com/Cannot-get-current-page-from-AjaxPagingNavigator-tp3034524p3034524.html
> To start a new topic under Apache Wicket, email
> ml-node+1842946-398011874-65...@n4.nabble.com<ml-node%2b1842946-398011874-65...@n4.nabble.com>
> To unsubscribe from Apache Wicket, click 
> here<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=>.
>
>
>


-- 
Sincerely,
JC (http://www.linkedin.com/in/jcgarciam)
Work smarter, not harder!.

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Cannot-get-current-page-from-AjaxPagingNavigator-tp3034524p3034563.html
Sent from the Users forum mailing list archive at Nabble.com.

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

Reply via email to