Re: Cannot get current page from AjaxPagingNavigator

2010-11-10 Thread jcgarciam
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 wrote: > I would change: > final Label currentPage = new Label("currentPage", new Model()); > > to this: > Label currentPage = new Label("cu

Re: Cannot get current page from AjaxPagingNavigator

2010-11-10 Thread jcgarciam
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

Re: Cannot get current page from AjaxPagingNavigator

2010-11-10 Thread vp143
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", dataLi

Re: Cannot get current page from AjaxPagingNavigator

2010-11-09 Thread Pedro Santos
I think you need to implement the AjaxPagingNavigator#onAjaxEvent method and add the currentPage component on target. On Tue, Nov 9, 2010 at 4:20 PM, vp143 wrote: > > Thank you both for your responses- I totally forgot about it being dynamic. > > However, I have tried both code snippets above bu

Re: Cannot get current page from AjaxPagingNavigator

2010-11-09 Thread vp143
Thank you both for your responses- I totally forgot about it being dynamic. However, I have tried both code snippets above but still no luck. I printed the current page within the load() method which prints 0 only on first load. No message is printed when the page numbers from AjaxPagingNavigator

Re: Cannot get current page from AjaxPagingNavigator

2010-11-09 Thread Pedro Santos
Use an dinamic model, ex: Label currentPage = new Label("currentPage", new AbstractReadOnlyModel() { public String getObject() { return pagination.getPageable().getCurrentPage(); } }); On Tue, Nov 9, 2010 at 2:04 PM, Vishal Popat wrote: > Hi all, >

Re: Cannot get current page from AjaxPagingNavigator

2010-11-09 Thread jcgarciam
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