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

  • Home
  • SEARCH
  • 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 8401455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:48:40+00:00 2026-06-09T21:48:40+00:00

Is it possible to load data lazily into a GWT DataGrid, similarly to how

  • 0

Is it possible to load data lazily into a GWT DataGrid, similarly to how the GWT CellList lazily loads data?

I have a GWT DataGrid that can potentially bring back hundreds of rows, but only about 20 rows are displayed at a time. When this occurs, the loading of the grid is quite slow.

I want to use a DataGrid instead of a CellTList because I have multiple columns of data that need to be displayed. And I’ve opted for a DataGrid instead of a CellTable because I want the header columns to be fixed.

  • 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-09T21:48:42+00:00Added an answer on June 9, 2026 at 9:48 pm

    Since DataGrid doesn’t expose it’s ScrollPanel, create an inner class that extends DataGrid and provides a reference to the ScrollPanel:

    private static class MyDataGrid<T> extends DataGrid {
        public ScrollPanel getScrollPanel() {
            HeaderPanel header = (HeaderPanel) getWidget();
            return (ScrollPanel) header.getContentWidget();
        }
    }
    

    Initialize the variables needed for this to work:

    private MyDataGrid<MyDataType> myDataGrid;
    private int incrementSize = 20;
    private int lastScrollPos = 0;
    

    In the constructor, create the grid:

    myDataGrid = new MyDataGrid<MyDataType>();
    

    Then add a ScrollHandler, using the getScrollPanel() reference that was just created:

    myDataGrid.getScrollPanel().addScrollHandler(new ScrollHandler(){
    
        @Override
        public void onScroll(ScrollEvent event) {
    
            int oldScrollPos = lastScrollPos;
            lastScrollPos = myDataGrid.getScrollPanel().getVerticalScrollPosition();
    
            // If scrolling up, ignore the event.
            if (oldScrollPos >= lastScrollPos) {
                return;
            }
    
            //Height of grid contents (including outside the viewable area) - height of the scroll panel
            int maxScrollTop = myDataGrid.getScrollPanel().getWidget().getOffsetHeight() - 
                               myDataGrid.getScrollPanel().getOffsetHeight();
    
            if(lastScrollPos >= maxScrollTop) {
                myDataGrid.setVisibleRange(0,myDataGrid.getVisibleRange().getLength()+incrementSize);
            }
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I first load data into a Silverlight DataGrid control, how can I make
I have a program that load data from a file using std::ifstream and store
Due to fact that I load data from a database and place it into
Is it possible to load a data region (matrix) only on request. I have
Here is the SQL query I have so far: LOAD DATA INFILE 'filename.csv' INTO
Is it possible to load an html document into a DOM javascript object so
Is it possible to load a User Control that was registered in the web.config
I'd like to know how it is possible to load options & data graph
Mysql LOAD command lets import data from csv files LOAD DATA INFILE 'data.csv' INTO
I have been experimenting with LOAD DATA INFILE and there are a couple things

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.