Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Viritin - using SortableLazyList with FilterableListContainer

Oskar Hýbl
6 years ago Dec 03, 2015 1:33pm
E G
5 years ago May 25, 2016 11:25am

Hi,

do anyone (especially Matti) know how to solve this issue?

I am also not able to filter the MTable

SortablePagingProvider<People> pageProvider = new SortablePagingProvider<People>() {

      @Override
      public List<People> findEntities(int firstRow, boolean ascending, String sortField) {

        return peopleCollector.collect(ascending, sortField, filters);
      }
    };

    CountProvider countProvider = new CountProvider() {

      @Override
      public int size() {
        return peopleCollector.countPeople();
      }
    };

    peopleOverviewTable.lazyLoadFrom(pageProvider, countProvider, pageSize);

Error:

java.util.NoSuchElementException: null
    at java.util.AbstractList$Itr.next(AbstractList.java:364)
    at java.util.SubList$1.next(AbstractList.java:707)
    at java.util.AbstractCollection.toArray(AbstractCollection.java:141)
    at java.util.ArrayList.<init>(ArrayList.java:177)
    at org.vaadin.viritin.LazyList.subList(LazyList.java:290)
    at org.vaadin.viritin.ListContainer.getItemIds(ListContainer.java:120)
    at com.vaadin.ui.Table.getItemIds(Table.java:2271)
    at com.vaadin.ui.Table.getVisibleCellsNoCache(Table.java:2221)
    at com.vaadin.ui.Table.refreshRenderedCells(Table.java:1745)
    at com.vaadin.ui.Table.enableContentRefreshing(Table.java:3276)
    at com.vaadin.ui.Table.changeVariables(Table.java:3118)
.
.
.

 

Matti Tahvonen
5 years ago May 27, 2016 8:28am
Fahim Feroje Al Jami
4 years ago Aug 08, 2017 1:02pm
Pere Pasqual
4 years ago Mar 26, 2018 6:52am
Matti Tahvonen
4 years ago Mar 26, 2018 7:52am

I think Pere is right here. Your findAll method seem to sanitize the end index properly, so the MTable must be requesting a page that start beyond the end of your list.

BTW. I guess you are just prototyping with it currently, but wanted to underline that lazy binding don't help you to save any memory, if your data is in JVM memory anyways as in your and mine example. The real queries must happen in the DB layer.

cheers, matti