Infinite / Virtual - Lazy Loading table


Is posibility in Vaadin to create Table working like in this example? :

I want to show table that have milions of rows and making count on this is taking a lot of time (Firebird database engine is awful on making count).
I wanted to use table with SQLContainer so I looked how this is working with Table Vaadin’s component and SQLContainer. But unfortunately Table is making count from time to time to determine how long scrolbar should be, and also is showing current range of visible records while scrolling, which is good in most cases.

Solution to my problem is Table that will never ask database about count, but when the scrollbar is in bottom, will load next portion of data.

Is there any posibility to get this functionality for now?

If not, Can this be taken into account when creating new Table component > 7.1 Vaadin version?


Some time ago i asked question about this feature
. But current implementation of vaadin library do not provide such possibilities. In your case, there are several ways to solve your problem:

  • Use filter for the displayed data(Why do you show a million records?)
  • Use wrapped table class for receive notification about that you need more data

I chose the second path, but he has the drawbacks. Because data source for the table is a container class, and it grows in size on the server side, not client side. So …
After i mixed two ways. And now for me so far is enough.
If you need my wrapper of Table class, i may publish this in forum.

Good luck

I will be very grateful if you share wrapper class. I will look closer into it and I will adopt to my needs.

Best regards.

The archive contains 4 files

Usage(Taken from working project):

public class SwiftModule extends Module implements Button.ClickListener, TableNeedDataListener {
   private ScrollableTable table;

table.addListener((TableNeedDataListener) this);

    public void needData(TableNeedDataEvent event) {
        startPosition = table.getContainerDataSource().size() + 1;
        endPosition = startPosition + 50;
    } (2.23 KB)