Try calling scrollToBottom after the event loop has finished by running it
inside a call to Scheduler.get().scheduleDeferred(...)
Paul
On 16/08/12 06:15, Magnus wrote:
> 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();
> }
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/oGv5jvVSM3cJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.