Search code examples
scrollsmartgwttabpanellistgrid

Large SmartGWT ListGrid in TabPanel, how to get one set of scroll bars


I have a potentially very large ListGrid that is one panel of a GWT TabPanel. Even giving it a width of 2000 pixels and a height of 6000 pixels, it does not fit in either dimension. Which means I end up with a vertical scroll bar for the TabPanel (the screen isn't 6000 px high) and horizontal and vertical scrollbars for the ListGrid.

So users will have very few items in this ListGrid, while others will have hundreds of lines. Is there a way to tell the ListGrid to just fit the size of the enclosing panel, and only have one set of scrollbars?

Thank you, Greg


Solution

  • Ok, found the answer:

    theGrid.setAutoFitData (Autofit.VERTICAL);
    theGrid.setHeight (1);
    theGrid.setShowAllRecords (true);
    theGrid.setBodyOverflow (Overflow.VISIBLE);
    theGrid.setOverflow (Overflow.VISIBLE);
    theGrid.setLeaveScrollbarGap (false);
    

    This sets up the ListGrid so that it changes size based on the number of rows it has, and does not restrict its size to the viewable area.