-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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
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) ;
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
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 :)
Asked: 2009-10-28 08:49:36 +0800
Seen: 472 times
Last updated: Oct 28 '09