Grid setAllRowsVisible() alternative?

I have been using setAllRowsVisible() on my grids, as the expanding-contracting height is perfect for my application. We have EXTENSIVE filtering, so sometimes there will only be a handful or no results shown - In this case, we want the grid to shrink down. Now, our dataset is a lot larger, (600 up from 60 grid entries) and the performance impact is obviously unusable. Is there an alternative to setAllRowsVisible() that would let me keep this responsive height but without sacrificing all lazy-loading?


Aside from manually resizing your Grid I suppose

You can check the number of rows and use a grid with setAllRowsVisible if the number of entries is low.

(I’m not sure what you’re trying to do, when you have too many rows)
You could also use the pagination grid (Community addon)

We were using paginated grid in an early version, but we needed to swap from it (not too sure why, I think because we had selection boxes in the grid and we needed to be able to select more than a pages worth or something similar) so thats unfortunately a no-go.

That’s my best idea so far! I already have a listener to display a “No results” span when the grid is empty, so I guess for less than 20 etc results I could toggle the setAllRowsVisible()

My only issue is the scroll bar appears when its not setAllRowsVisible - i think the bar appearing and dissapearing would be a little jarring

You could hide it with CSS

Maybe that could help: NoScrollGrid Flow Addon - Vaadin Add-on Directory
But I have no idea if it’s working in the latest version of Vaadin

(The idea is to delegate the scrolling to a parent so you can have the lazy loading and the no-scroll grid: [grid] Delegate scrolling to ancestor element · Issue #1863 · vaadin/web-components · GitHub)

With the frontend/themes/mytheme etc custom CSS?

This looks promising, thank you! Ill check it out :)