Lazy loading in a table
When we work with tables, we often want to load rows quickly, no matter how big the tables are. In tables with a few rows, it isn't problem, but when we have thousands of rows, it can freeze the web browser. For such cases, there is support for lazy loading in Vaadin's tables. Lazy loading means that rows are loaded later. Table
loads only the visible rows plus some rows are buffered for scrolling. The rest of the rows are loaded on demand.
In this recipe, we will create a table with ten thousand rows. It's big table, but as shown in the following screenshot, only the required part of the table is loaded. When we scroll to the rows that are not loaded, we will see an empty table with a row number range which will be loaded afterwards.
How to do it...
Carry out the following steps to learn how to use the lazy loading feature of Table
:
We create a Vaadin project with a main UI class named
Demo
as follows:public class Demo extends UI {…}
We need a bean item for the data...