Hello Martin,
thanks for your reply. I solved it with the query parameters. Introducing
AjaxLink would would have been propably to much rework as the paging
component is already somewhat complex and i tried to reuse as much as
possible of the PagingNavigator of wicket-extensions. Maybe next time i will
try the ajax option.
Here's the code:
//save the scrollposition and append it as query parameter to 'href'
attribute
public SimpleAttributeModifier createAppendScrollPositionAttModifier() {
return new SimpleAttributeModifier(
"onclick",
"var params = {
pageXOffset:top.window.pageXOffset,
pageYOffset:top.window.pageYOffset };"
+ "\n var str =
jQuery.param(params);"
+ "\n str = '&' +
str;"
+ "\n var
href=$(this).attr('href');"
+ "\n href = href +
str;"
+ "\n
$(this).attr('href', href);");
}
//scroll to previous scrolling position
public static AbstractBehavior createScrollBehavior(String pageXOffset,
String pageYOffset){
return BehaviorUtils
.createTemporaryOnloadJavascriptBehaviour(
"top.scrollTo(" + pageXOffset
+ "," + pageYOffset + ");"
);
}
//Add the scrolling behavior
String pageXOffset = getRequest().getParameter("pageXOffset");
pageXOffset = "null".equals(pageXOffset) ? "0" :
pageXOffset;
String pageYOffset =
getRequest().getParameter("pageYOffset");
pageYOffset = "null".equals(pageYOffset) ? "0" :
pageYOffset;
add(BehaviorUtils.createScrollBehavior(pageXOffset,
pageYOffset));
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Recreate-Scroll-Position-after-Paging-click-on-paging-link-tp4228868p4240037.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]