Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8594015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:06:48+00:00 2026-06-12T00:06:48+00:00

I have a problem with getting setScrollTop to work in GWT. Basically, I’m trying

  • 0

I have a problem with getting setScrollTop to work in GWT.
Basically, I’m trying to set a custom scroll position (to focus on a particular, desired element), right after the view is built. It doesn’t seem to work because I don’t set it at the correct time (and the UI might still be under rendering/construction, etc).

Setup is as follows.

  • I have a widget who’s start method looks like this :

    public void start(AcceptsOneWidget widget, EventBus eventBus) {
    
         widget.setWidget(view);s
             Runnable onLoadCallback = new Runnable() {
             public void run() {
                 initView();
             }
         };
    
         VisualizationUtils.loadVisualizationApi(onLoadCallback, LineChart.PACKAGE);
    }
    
  • inside the initView panel, I dynamically build a view which contains some charts (by doing a request to the server, waiting for the answer to come, and then rendering the UI based on server’s answer).

  • after the answer from the server arrives, and after I finished building the UI, I’m trying to set the scroll position like this :

    view.getContainerPanel().getElement().setScrollTop(2000);
    
  • this seems to have absolutely no effect whatsoever. HOWEVER, if I leave this view, and get back to it a bit later, it does work (presumably because it has already been initialized or something ?)

Question would be : what is the correct moment to call setScrollTop ? I tried overriding some of the methods from the corresponding view, but it doesn’t seem to work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T00:06:49+00:00Added an answer on June 12, 2026 at 12:06 am

    Use a Scheduler after initView():

    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
    
        @Override
        public void execute() {
            view.getContainerPanel().getElement().setScrollTop(2000);
        }
    });
    

    Explanation:

    Your program does not know how long it will take the browser to render the view. This is what Scheduler.scheduleDeferred() method was created for. It tells your program to wait until the browser has finished doing whatever it was doing and is ready for the next task.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey I have a problem getting my head around how custom GWT event Handlers
I have a problem getting boost::multi_index_container work with random-access and with orderd_unique at the
I have this problem getting my newly created php project on Netbeans work on
I'm using jqGrid and I have a problem getting Dynamic Linq to work. I
I have a problem with getting my pager-function to work. For some reason it
I have problem getting the dropdown menu to work using Twitter's Bootstrap. Here's my
I have a problem getting the following scenario to work. A student can take
I have a problem getting sorting to work with multiple joined tables. For example:
I have a problem getting matplotlib 1.0.0 to work in Python 2.5.2 ( Ubuntu
I have a problem getting this JPA query to work on MS SQL Server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.