Vaadin grid - filtering with lazy loading

2019-06-04 21:52发布

问题:

I have vaadin grid, and it's great that it has lazy data loading from the box. But for some reasons I have custom filters, which I use via

CallbackDataProvider<> dataProvider.fetch(Query query)

Query object has parameters for loading by portions (offset and limit), so I need to set it dynamically (?) and somehow listen grid scrolling event to load next part of data when user scrolls down (?)

Grid.dataComunicator has field Range pushRows but there no public methods to get it. And all i have is grid with lazy loading without filtered data or grid with eager loading with filtered data.

So, is there any way to implement filtering data with lazy loading in vaadin grid element?

回答1:

ok, problem solved by using ConfigurableFilterDataProvider<> as wrapper over CallbackDataProvider<>. so, when i filter table, this wrapper adds filtering conditions to all queries, and data loads lazy as usual.