0

How to scroll up after the user move to the next page (paging component)?

asked 2009-10-28 08:49:36 +0800

fmcypriano gravatar image fmcypriano
612 1 7
http://felipecypriano.com...

Hello all,

I've a grid and a paging component and I'd like to scroll up the user view when he changes to the next or previous page. How could I do this?

public void onPaging_pagingPedidos(PagingEvent event) {
    // loads the data from database
    // scroll the users view up, is it possible?
}


Regards

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2009-10-28 09:35:52 +0800

caclark gravatar image caclark
1753 2 5
http://clarktrips.intltwi...

If you know the page number, you can multiply that by the page size to get the first entry on the page. Use that number to get the item from the grid and then use that item with Clients.scrollIntoView(Component cmp) something like this:

    Grid  grid = .... ;
    int child = pageSize * pageNumber ;
    Rows rows = grid.getRows() ;
    Row   row  = (Row)rows.getChildren().get(child) ;
    Clients.scrollIntoView(row) ;

link publish delete flag offensive edit

answered 2009-10-28 11:34:41 +0800

fmcypriano gravatar image fmcypriano
612 1 7
http://felipecypriano.com...

Thanks for the tip caclark.

I did a little different and it worked for me:

    Grid  grid = .... ;
    Rows rows = grid.getRows() ;
    Row   firstRow  = (Row)rows.getFirstChild()
    Clients.scrollIntoView(firstRow) ;


Regards

link publish delete flag offensive edit

answered 2009-10-28 11:41:34 +0800

fmcypriano gravatar image fmcypriano
612 1 7
http://felipecypriano.com...

One more suggestion to this, scroll to the grids header:

    Grid  grid = .... ;
    Colums header = grid.getColumns() ;
    Clients.scrollIntoView(header) ;

I think this one is better, because the user sees the header and realize that the page auto-scrolled up :)

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-10-28 08:49:36 +0800

Seen: 472 times

Last updated: Oct 28 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More