Skip to content
Advertisement

Vaadin grid – filtering with lazy loading

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?

Advertisement

Answer

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.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement