You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Carlo M. Camerino (JIRA)" <ji...@apache.org> on 2009/01/04 19:35:44 UTC

[jira] Created: (WICKET-2001) AjaxPagingNavigator returns wrong current page when extending

AjaxPagingNavigator returns wrong current page when extending
-------------------------------------------------------------

                 Key: WICKET-2001
                 URL: https://issues.apache.org/jira/browse/WICKET-2001
             Project: Wicket
          Issue Type: Bug
          Components: wicket-extensions
    Affects Versions: 1.3.5
         Environment: Windows
            Reporter: Carlo M. Camerino


Hi, 
I tried extending AjaxPagingNavigator and created this class

package com.ccti.base.web.navigation;

import org.apache.wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigator;
import org.apache.wicket.behavior.SimpleAttributeModifier;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.navigation.paging.IPageable;
import org.apache.wicket.markup.html.navigation.paging.IPagingLabelProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SXIPagingNavigator extends AjaxPagingNavigator {
	
	private static final Logger logger = LoggerFactory.getLogger(SXIPagingNavigator.class);
	
	public SXIPagingNavigator(String id, IPageable pageable) {
		super(id, pageable);
		add(new SimpleAttributeModifier("class", "pagination"));
		// TODO Auto-generated constructor stub
		logger.debug(getPageable().getPageCount() + "");
		logger.debug(getPageable().getCurrentPage() + "");
		
		
		add(new Label("totalPages", getPageable().getPageCount() + ""));
	}

	public SXIPagingNavigator(String id, IPageable pageable,
			IPagingLabelProvider labelProvider) {
		super(id, pageable, labelProvider);
		add(new SimpleAttributeModifier("class", "pagination"));
		// TODO Auto-generated constructor stub
	}

}

<html>
<body>
  <wicket:panel>
	<a wicket:id="first">&lt;&lt;</a>&nbsp;<a wicket:id="prev">&lt;</a>
    <span wicket:id="navigation">
		  <a wicket:id="pageLink" href="#"><span wicket:id="pageNumber">5</span></a>
    </span>
    <a wicket:id="next">&gt;</a>&nbsp;<a wicket:id="last">&gt;&gt;</a>
    <span>Page Count : <span wicket:id = "totalPages"/></span>
  </wicket:panel>
</body>
</html>

pageable.getCurrentPage() always returns 0 even if i changed page already.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WICKET-2001) AjaxPagingNavigator returns wrong current page when extending

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2001?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-2001.
-----------------------------------

    Resolution: Invalid
      Assignee: Igor Vaynberg

you call getcurrentpage() only from the constructor - which is only called once when the component is constructed. see models page on the wiki for hints on how to display dynamic values using labels.

> AjaxPagingNavigator returns wrong current page when extending
> -------------------------------------------------------------
>
>                 Key: WICKET-2001
>                 URL: https://issues.apache.org/jira/browse/WICKET-2001
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-extensions
>    Affects Versions: 1.3.5
>         Environment: Windows
>            Reporter: Carlo M. Camerino
>            Assignee: Igor Vaynberg
>
> Hi, 
> I tried extending AjaxPagingNavigator and created this class
> package com.ccti.base.web.navigation;
> import org.apache.wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigator;
> import org.apache.wicket.behavior.SimpleAttributeModifier;
> import org.apache.wicket.markup.html.basic.Label;
> import org.apache.wicket.markup.html.navigation.paging.IPageable;
> import org.apache.wicket.markup.html.navigation.paging.IPagingLabelProvider;
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
> public class SXIPagingNavigator extends AjaxPagingNavigator {
> 	
> 	private static final Logger logger = LoggerFactory.getLogger(SXIPagingNavigator.class);
> 	
> 	public SXIPagingNavigator(String id, IPageable pageable) {
> 		super(id, pageable);
> 		add(new SimpleAttributeModifier("class", "pagination"));
> 		// TODO Auto-generated constructor stub
> 		logger.debug(getPageable().getPageCount() + "");
> 		logger.debug(getPageable().getCurrentPage() + "");
> 		
> 		
> 		add(new Label("totalPages", getPageable().getPageCount() + ""));
> 	}
> 	public SXIPagingNavigator(String id, IPageable pageable,
> 			IPagingLabelProvider labelProvider) {
> 		super(id, pageable, labelProvider);
> 		add(new SimpleAttributeModifier("class", "pagination"));
> 		// TODO Auto-generated constructor stub
> 	}
> }
> <html>
> <body>
>   <wicket:panel>
> 	<a wicket:id="first">&lt;&lt;</a>&nbsp;<a wicket:id="prev">&lt;</a>
>     <span wicket:id="navigation">
> 		  <a wicket:id="pageLink" href="#"><span wicket:id="pageNumber">5</span></a>
>     </span>
>     <a wicket:id="next">&gt;</a>&nbsp;<a wicket:id="last">&gt;&gt;</a>
>     <span>Page Count : <span wicket:id = "totalPages"/></span>
>   </wicket:panel>
> </body>
> </html>
> pageable.getCurrentPage() always returns 0 even if i changed page already.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.