I got it working with the following code- thanks Pedro and JC

        final Label currentPage = new Label("currentPage", new Model());
        currentPage.setOutputMarkupId(true);
        add(currentPage);

        final AjaxPagingNavigator pagination = new
AjaxPagingNavigator("navigator", dataList) {
                @Override
                protected void onAjaxEvent(AjaxRequestTarget target) {
                        target.addComponent(currentPage);
                        super.onAjaxEvent(target);
                }
        };
        add(pagination);

        LoadableDetachableModel model = new LoadableDetachableModel() {
                public Object load(){
                        return pagination.getPageable().getCurrentPage() + 1;
                }
        };
        currentPage.setDefaultModel(model);

It had to be written like this because the model needs pagination which
would not have been initialised if written as an inner class when creating
the label.
Please let me know if anyone finds a better way of writing it.

Many thanks again
Vishal
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Cannot-get-current-page-from-AjaxPagingNavigator-tp3034524p3035648.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