Magnus
unread,Aug 16, 2012, 1:15:03 AM8/16/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-we...@googlegroups.com
Hello,
I have a CellTable within a ScrollPanel with a fixed number of rows (40). Whenever the CellTable is filled with data by an AsyncDataProvider, the ScrollPanel should scroll down to the end of the CellTable.
So I call scrollToBottom at the end of the load process triggered by onRangeChanged, i. e. within onRangeChangend a RPC call is made to fetch the new data, and on response to this call the data is pushed into the CellTable and scrollToBottom is called (see below).
However, the scrolling does not work. I tried to trace it with a Window.alert call, and I believe that the CellTable with the new data is not yet displayed when scrollToBottom is called.
What can I do?
Any hints are welcome!
Thank you
Magnus
// AsyncDataProvider:
protected void onRangeChanged(HasData<MyData> display)
{
Range r = display.getVisibleRange();
int start = r.getStart() + 1;
int end = start + r.getLength() - 1;
loadData (start,end);
}
protected void loadData(int start,int end)
{
AsyncCallback<List<MyData>> cbk = new AsyncCallback<List<MyData>>()
{
public void onFailure (Throwable thr) { }
public void onSuccess (List<MyData> lst)
{
loadData (lst);
}
};
dataService.loadData (start,end,cbk);
}
protected void loadData (List<MyData> lst)
{
Range r = pager.getDisplay().getVisibleRange();
int start = r.getStart();
dataProvider.updateRowData (start,lst);
Window.alert("scroll to bottom");
scp.scrollToBottom();
}