Ohh sorry, now that i read your code carefully i see you have a case of the Chicken and the Egg!! :)
On Wed, Nov 10, 2010 at 11:30 AM, Juan Carlos Garcia <jcgarc...@gmail.com>wrote: > I would change: > final Label currentPage = new Label("currentPage", new Model()); > > to this: > Label currentPage = new Label("currentPage", new LoadableDetachableModel(){ > public Object load(){ > return pagination.getPageable().getCurrentPage() + 1; > > > } > > }); > > and then just remove the last part: > currentPage.setDefaultModel(model); > > On Wed, Nov 10, 2010 at 5:19 AM, vp143 [via Apache Wicket] < > ml-node+3035648-2145298352-65...@n4.nabble.com<ml-node%2b3035648-2145298352-65...@n4.nabble.com> > > wrote: > >> 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 message @ >> http://apache-wicket.1842946.n4.nabble.com/Cannot-get-current-page-from-AjaxPagingNavigator-tp3034524p3035648.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!. > > -- 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-tp3034524p3036177.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