Re: Recreate Scroll-Position after Paging (click on paging link)

2011-12-28 Thread brazz
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: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Recreate Scroll-Position after Paging (click on paging link)

2011-12-26 Thread Martin Grigorov
Hi,

You'll need to add some JavaScript logic to your code to support that.
First add click listener to the navigation link that will extract the
current scroll coordinates and append them in the href.
Then you need to add ondomready listener so that after page's DOM is
ready you can parse the params from the query string and
scrollTo(coords)

With AjaxLink all this is not needed because only the pageable is
replaced and if it has the same size (items number) then there is no
change of the scroll position.

On Fri, Dec 23, 2011 at 4:58 PM, brazz alexander.li...@man.eu wrote:
 I have created a custom paging component with the help of
 org.apache.wicket.markup.html.navigation.paging.PagingNavigation.
 In my PagingNavigator i have paging -links on top and at the bottom of the
 DataView.

 Now, when the user clicks on a link, i want to recreate the scroll-position
 so that the screen does not jump after paging.

 How can i submit the scroll-coordinates to the server when the user clicks
 on a
 org.apache.wicket.markup.html.navigation.paging.PagingNavigationLink which
 is a org.apache.wicket.markup.html.link.Link.

 Is there a way to append the scroll-coordinates as query parameters to a
 org.apache.wicket.markup.html.link.Link or is it only possible with
 Ajax-Links?

 The problem is not the javascript-part of scrolling that already works with
 the help of behaviors.

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Recreate-Scroll-Position-after-Paging-click-on-paging-link-tp4228868p4228868.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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Recreate Scroll-Position after Paging (click on paging link)

2011-12-23 Thread brazz
I have created a custom paging component with the help of
org.apache.wicket.markup.html.navigation.paging.PagingNavigation.
In my PagingNavigator i have paging -links on top and at the bottom of the
DataView. 

Now, when the user clicks on a link, i want to recreate the scroll-position
so that the screen does not jump after paging. 

How can i submit the scroll-coordinates to the server when the user clicks
on a 
org.apache.wicket.markup.html.navigation.paging.PagingNavigationLink which
is a org.apache.wicket.markup.html.link.Link.

Is there a way to append the scroll-coordinates as query parameters to a 
org.apache.wicket.markup.html.link.Link or is it only possible with
Ajax-Links?

The problem is not the javascript-part of scrolling that already works with
the help of behaviors.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Recreate-Scroll-Position-after-Paging-click-on-paging-link-tp4228868p4228868.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



scroll position

2009-10-08 Thread Douglas Ferguson
I have a DataView that I add to the ajax target on a timer, so that  
data can be refreshed as loaded by a background process.

If the user is view the data and scrolls down, the scroll bar is reset  
to the top when the timer refreshes the view.

The only solution I can come up with is to set scroll top using  
javascript.

I am curious if there is a way to retrieve the current y position from  
javascript during an ajax request.

I.E.

1) When the event is triggered
 getScrollPosition and save it to the page
 refresh the view.

View
2) onLoad - scrollTo - last saved position


I've seen some people use cookies but I don't think this is a robust  
as storing on the page object.



Douglas

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org