Hy, 

I have the same Problem. I tried the solution of Paul Robinson, but 
nevertheless, nothing happens.
Where is my mistake? Here is my code:

public static ScrollPanel scrollPanel;
// ...
private void loadInputFunctions() {
        input.addKeyDownHandler(new KeyDownHandler() {

            @Override
            public void onKeyDown(KeyDownEvent event) {
                if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
                    // ...
                    }
                    input.setText(">>");
                    Scheduler.get().scheduleDeferred(
                            new Scheduler.ScheduledCommand() {
                                @Override
                                public void execute() {
                                    scrollPanel.scrollToBottom();
                                }
                            });
                }

            }
        });
    }

Thanks in advance.

Am Donnerstag, 16. August 2012 07:55:04 UTC+2 schrieb Paul Robinson:
>
> 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 
> > google-we...@googlegroups.com<javascript:>. 
>
> > To unsubscribe from this group, send email to 
> google-web-toolkit+unsubscr...@googlegroups.com <javascript:>. 
> > 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 unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to