Combo Boxes not filtering as expected

When re-implementing combo boxes with CrudEntityDataProviders as in the bakery demo, my combo boxes are not filtering on either the client or the server. When I locally run the bakery app with no modifications, combo boxes do not filter. When I run the bakery demo on the Vaadin site, they STILL do not filter (when selecting a product in an order, for example) - verified in Chrome (PC and Mac) and Safari (Mac). However, when I set up a static list of items, the combo box filters just fine. It appears that the query string is not being passed to the data provider methods. What might I be doing wrong?

Is this in the wrong forum? SHould I try StackOverflow? Submit a bug? Can anyone help in any way, at least point me to the right place to ask this? This worked fine in Vaadin 8.

Hi,

This is the right place but some forum posts are forgotten, especially during July.

I think it’s a bug of the spring dataprovider add-on (or the demo doesn’t use the add-on properly). I’ve opened a ticket here:
https://github.com/Artur-/spring-data-provider/issues/23

Debugging code in my fetchFromBackEnd and sizeInBackEnd methods show me that the filter is empty which tells me there is something wrong with the construction of the ComboBox itself…I guess it’s trying to filter client-side which is not working either.

The combobox never called setFilter of the FilterablePageableDataProvider and FilterablePageableDataProvider does not use the query filter given by the combobox.
If you change the FilterablePageableDataProvider to this:

package org.vaadin.artur.spring.dataprovider;

import com.vaadin.flow.data.provider.Query;
import java.util.Optional;
import java.util.stream.Stream;

public abstract class FilterablePageableDataProvider<T, F> extends PageableDataProvider<T, F> {
    private F filter = null;

    public FilterablePageableDataProvider() {
    }

    public void setFilter(F filter) {
        if (filter == null) {
            throw new IllegalArgumentException("Filter cannot be null");
        } else {
            this.filter = filter;
            this.refreshAll();
        }
    }

    public int size(Query<T, F> query) {
        return super.size(this.getFilterQuery(query));
    }

    public Stream<T> fetch(Query<T, F> query) {
        return super.fetch(this.getFilterQuery(query));
    }

    private Query<T, F> getFilterQuery(Query<T, F> t) {
        F filter = t.getFilter().orElse(this.filter);
        return new Query(t.getOffset(), t.getLimit(), t.getSortOrders(), t.getInMemorySorting(), filter);
    }

    protected Optional<F> getOptionalFilter() {
        return this.filter == null ? Optional.empty() : Optional.of(this.filter);
    }
}

The filtering is working.