Hi,
I’m trying to implement a sorting lazy-data loading in my grid.
I’ve followed the instruction in the doc but I have a problem.
In the method Dataprovider.fromCallBacks, “query.getSortOrders” return
an empty list.
Is someone have an idea ?
For the moment I try just to add sorting on the column “colCodArt”.
Just a precision, I have the problem directly when I load the grid for the first time. So I don’t have the possibility to sort the
column because the grid is not displayed. But after It’s already empty when I change the sort.
So Ok, I’ve believed it was because of an error in my code that this method return nothing.
So I’ve managed this empty sort but after I have an error when I want to sort my list with the comparator.
when the instruction “items.sort(comparator);” is execute I have this error
java.lang.UnsupportedOperationException: null
at java.base/java.util.Collections$UnmodifiableList.sort(Collections.java:1343) ~[na:na]
at com.steel.dao.ComposantTService.findByFamcodeAndSfamcode(ComposantTService.java:132) ~[classes/:na]
at com.steel.dao.ComposantTService.getCompBySousfam(ComposantTService.java:62) ~[classes/:na]
at com.steel.view.UpdateCompView.lambda$94(UpdateCompView.java:1022) ~[classes/:na]
at com.vaadin.flow.data.provider.CallbackDataProvider.fetchFromBackEnd(CallbackDataProvider.java:137) ~[flow-data-2.1.9.jar:2.1.9]
at com.vaadin.flow.data.provider.AbstractBackEndDataProvider.fetch(AbstractBackEndDataProvider.java:61) ~[flow-data-2.1.9.jar:2.1.9]
at com.vaadin.flow.data.provider.DataCommunicator.fetchFromProvider(DataCommunicator.java:362) ~[flow-data-2.1.9.jar:2.1.9]
at com.vaadin.flow.data.provider.DataCommunicator.activate(DataCommunicator.java:642) ~[flow-data-2.1.9.jar:2.1.9]
at com.vaadin.flow.data.provider.DataCommunicator.collectKeysToFlush(DataCommunicator.java:589) ~[flow-data-2.1.9.jar:2.1.9]
at com.vaadin.flow.data.provider.DataCommunicator.flush(DataCommunicator.java:461) ~[flow-data-2.1.9.jar:2.1.9]
at com.vaadin.flow.data.provider.DataCommunicator.lambda$requestFlush$2f364bb9$1(DataCommunicator.java:425) ~[flow-data-2.1.9.jar:2.1.9]
at com.vaadin.flow.internal.StateTree.lambda$runExecutionsBeforeClientResponse$1(StateTree.java:368) ~[flow-server-2.1.9.jar:2.1.9]
at java.base/java.util.ArrayList.forEach(ArrayList.java:1510) ~[na:na]
For you , is the good code to use the comparator ?