Search code examples
vaadinvaadin23

Vaadin 23 Grid with details - stretch instead scroll


Is it possible to set up a Vaadin Grid with details (like in the Item Details example https://vaadin.com/docs/latest/components/grid) to stretch instead of displaying a scroll? I need to let the Grid grow as much as it needs to. Please tell me how to implement it.

P.S

I may only disable the visual scroll with grid.setVerticalScrollingEnabled(false); but it doesn't help with what I'm looking for. I also need to stretch the grid to avoid the grid scrolling at all. I'd like to use the entire page scrolling instead of grid personal scrolling.


Solution

  • There is a flag you can set

    setAllRowsVisible

    public void setAllRowsVisible​(boolean allRowsVisible) If true, the grid's height is defined by its rows. All items are fetched from the DataProvider, and the Grid shows no vertical scroll bar.

    Note: setAllRowsVisible disables the grid's virtual scrolling so that all the rows are rendered in the DOM at once. If the grid has a large number of items, using the feature is discouraged to avoid performance issues.

    Parameters:

    allRowsVisible - true to make Grid compute its height by the number of rows, false for the default behavior