Hi Matti,
I’ve started trying to adopt Viriting very recently, although I’ve been aware of its existance for quite a long time. I’m stil using Vaadin 7.7.13, and I’ve reached a critical point where the app I’m developing cannot scale any more due to its heavy usage of grids with large enough amounts of data and different performance problems with its different containers, SQLContainer (which theoretically supports lazy loading) very unusably buggy, and that on.
The Viritin version I’m using is, thus, v1.61.
Trying to learn how to use it is not an easy task. First of all, much of documentation and online examples are not working anymore. Code samples from the “Code Samples” (lol) tab in the plugin page are so simplistic that are not useful for real cases.
Most of “Related Links” do not work, too. None of the blog entries work anymore, displaying a big 404 page. The example app at org.vaadin.viritin.it does not work - even the domain doesn’t exist anymore. Other examples are not online anymore, either.
Nevertheless, I’ve managed to get it working somehow. My main interesit is to use the “lazy loading” of data in a Grid. What I’ve done so far is to populate a “classic” vaadin Grid setting its dataSource to a ListContainer.
By the way, one of the things I’d like to know is what’s the difference between using something like
Grid.setContainerDataSource(new ListContainer(new SortableLazyList<>(new SortableLazyList.SortablePagingProvider<...
and
MGrid<DemoBean> t = new MGrid<>();
final FilterableListContainer<DemoBean> lc = new FilterableListContainer<DemoBean>(new SortableLazyList<>(new SortableLazyList.SortablePagingProvider<DemoBean>() );
t.setContainerDataSource(lc);
I mean: what’s the point of using Mgrid vs “classical” Vaadin Grid, if any?
Appart from that, my lazy loading of items was working fine while simply using LazyList with its PagingProvider. But it turned to be useless as I needed the sorting and ordering feature the Grid provides.
My problem now is that I don’t understand at all the scarce examples I’ve found on the net, the most useful of them being at
https://github.com/viritin/viritin/blob/7934a94f5390029de7bbf4a26e559667b96293cf/src/test/java/org/vaadin/viritin/it/GridLazyLoadingAndSorting.java
and referenced by yourself in some bug report. I’m finding it hard to reproduce your example in real life. After studying your code, I think that what you mean there is to replace the
listOfPersons.subList()
parts with actual real calls to the DAO service and getting the proper “ranges of sets” needed to fetch the amount of data one is looking at each moment. That would also explain why you doo a
getListOfPersons(1000)
at the beginning, just ruining the whole purpose of lazy loading. Am I right?
Also, the
Collections.sort(listOfPersons, new BeanComparator<Person>(property))
part should again call in the end some DAO service method populating a collection of objects from a database query with the proper filtering parameters on it. Am I right, also?
I know I’m probably explaining myself very bad. But, in the end, is there any jdbc-oriented example which implements some real-world case using
SortableLazyList
with working filtering and sorting??