I'm building a page that uses a DataView to show data. At the top of the page is a form that has fields for searching and filtering. One of the requirements is to have a textfield where the user can type in the exact page they wish to goto. It also has first, prev, next, and last links. I built this pagenavigator by extending PagingNavigator and then adding it to the form.
When the page is first rendered the buttons all work great the textfield is updated showing the current page. However, after doing various searches the buttons will work, but the TextField stops updating. I was thinking that it has to do with the Navigator using Link components and sometimes the model for the TextField does not update because it is on a form. I'm not sure the best way to solve this though. I prefer not to use SubmitLink because I am trying to avoid javascript as much as possible. Here is my Navigator: public class MMTopPagingNavigator extends PagingNavigator { private static Logger log = Logger.getLogger(MMTopPagingNavigator.class); private IPageable pageable; public MMTopPagingNavigator(String id, IPageable pageable) { super(id, pageable); this.pageable = pageable; setup(pageable); } public MMTopPagingNavigator(String id, IPageable pageable, IPagingLabelProvider labelProvider) { super(id, pageable, labelProvider); this.pageable = pageable; setup(pageable); } protected void setup(IPageable pageable) { addOrReplace(new TextField("currentPage", new PropertyModel(this, "currentPage"))); addOrReplace(new Label("pageCount", new PropertyModel(pageable, "pageCount"))); } protected void onBeforeRender() { super.onBeforeRender(); // Hide the stuff we do not need! WebMarkupContainer container = new WebMarkupContainer("navigation"); container.addOrReplace(new Label("pageNumber")); container.addOrReplace(new Label("pageLink")); container.setVisible(false); addOrReplace(container); } public int getCurrentPage() { // After a while this stops getting called log.debug("currpage: " + pageable.getCurrentPage() + " numpages: " + pageable.getPageCount()); return pageable.getCurrentPage() + 1; } public void setCurrentPage(int i) { log.debug("setpage called with " + i); int requestedPage = (i - 1); if(i > pageable.getPageCount()) { requestedPage = pageable.getPageCount() - 1; } else if (requestedPage < 0) { requestedPage = 0; } pageable.setCurrentPage(requestedPage); } } Thanks! Ryan --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]