Search code examples
javaspring-bootvaadinvaadin8vaadin-grid

Expandable grid Vaadin UI


I have a simple grid. Two columns with a variable amount of rows. I want to make it so i have a header row with an arrow that can collapse and show the whole grid. So when I bring up the app, only the header row is visible with an arrow, and I can click to expand/collapse to show the rest of the grid.

A TreeGrid seems like overkill since I don’t need any hierarchical structure, just the ability to collapse/expand one row. I exclusively use IE and I’ve read that Drawyer doesnt work with IE 8 and above. I return a list of the objects and the object just has two string variables.

Any help with this? I am new to Vaadin 8.


Solution

  • Set grid height (workaround)

    As a workaround, you could set the height to be approximately the number of pixels you expect to be the height of the header.

    See the Sampler demo. Click the gear icon at top to expose properties of the example Grid object. The last property shown is "Size (W x H)". Change 100% to 100px to see the effect.

    Grid height set to 100%

    grid set to 100%

    Grid height set to 100px

    grid set to 100px

    You can also hide the footer (see checkbox in that property list).