GWT Window Scroll Bottom hit detection

1,763 views
Skip to first unread message

Alp Yilancioglu

unread,
Nov 27, 2012, 4:35:45 AM11/27/12
to google-we...@googlegroups.com
Hello;
 
how can i make the main page ( the page only uses the HTML Scroll Bar  (navigators scroll bar) )
auto load more results when the page hits the bottom. (like in ios apps )
 
unfortunetly i can only get the Scroll Top and ClientHeight and OffSetHeight .. these are not enough values for detecting page the bottom hit ?
 
 

alucard

unread,
Nov 27, 2012, 6:15:55 AM11/27/12
to google-we...@googlegroups.com
Have you seen this showcase example. When you scroll down the list it triggers an event when it reaches the end of the list on which You could load more data. See the code for ShowMorePagerPanel.
HTH

Andrea Boscolo

unread,
Nov 27, 2012, 4:45:55 PM11/27/12
to google-we...@googlegroups.com
They are more that enough, I guess.

maxVerticalScrollHeight = element.getScrollHeight() - element.getClientHeight()

then

if (element.getScrollTop() == maxVerticalScrollHeight)
  // bottom reached

That's the same idea behid ScrollPanel and the like.


On Tuesday, November 27, 2012 10:35:45 AM UTC+1, Alp Yilancioglu wrote:

Alp Yilancioglu

unread,
Nov 27, 2012, 5:35:10 PM11/27/12
to google-we...@googlegroups.com
 
Want to handle the event of Window.ScrollEvent  which belongs to the Explorer Application like iExplorer, Safari, Mozilla etc..
if try to use a panel or similar .. than i can do the calculations with getScrollHeight ( which is not available on window.ScrollEvent )
 
only available methods are ScrollTop , ScrollLeft , ClientHeight and OffsetHeight
 
 
com.google.gwt.user.client.Window.addWindowScrollHandler(_scrollHandler);
 
 
 
      Window.ScrollHandler _scrollHandler  = new Window.ScrollHandler()
              {
                  @Override
                  public void onWindowScroll(com.google.gwt.user.client.Window.ScrollEvent event) {  .........   }
             };
   

Alp Yilancioglu

unread,
Nov 27, 2012, 5:36:27 PM11/27/12
to google-we...@googlegroups.com
is there any other way that i can do this with the page position  or any other brilliant method ?

Jens

unread,
Nov 27, 2012, 6:39:27 PM11/27/12
to google-we...@googlegroups.com
Check out Document.get() and its scrolling related methods.

-- J.

Alp Yilancioglu

unread,
Nov 28, 2012, 3:33:29 AM11/28/12
to google-we...@googlegroups.com
 
Document.get() 
 
Thanks..
It worked..
Reply all
Reply to author
Forward
0 new messages