Hi, thanks for that component, It looks great, although I've found couple i

Hi, thanks for that component, It looks great, although I’ve found couple issues :

  1. The value for Binder is not being retrieved on change (it always has null)
  2. ValueChangeListener is triggered each time when you do the “click” on page (no value has been change and that event is still triggered)

Hi Jaroslaw, for now it is not likely I’ll be adding binder support but something like this could do the trick:

public class HelloWorldView extends HorizontalLayout {

    public class ExampleB {
        private String field;

        public String getField() {
            return field;
        }

        public void setField(String field) {
            this.field = field;
        }
    }

    private ExtendedAutosuggest<String> autosuggest = new ExtendedAutosuggest<>();
    private ExampleB bean = new ExampleB();

    public HelloWorldView() {
        setMargin(true);

        List<String> listOfStrings = new ArrayList<>();
        listOfStrings.add("jane");
        listOfStrings.add("sarah");
        listOfStrings.add("mary");
        listOfStrings.add("paul");
        listOfStrings.add("sean");
        listOfStrings.add("charles");
        listOfStrings.add("beth");
        listOfStrings.add("tania");
        listOfStrings.add("judith");
        listOfStrings.add("jason");

        add(autosuggest);
        autosuggest.setItems(listOfStrings);

        Binder<ExampleB> binder = new Binder<>(ExampleB.class);

        binder.forField(autosuggest)
                .withNullRepresentation("")
                .bind("field");

        binder.setBean(bean);

    }

    public class ExtendedAutosuggest<T> extends Autosuggest<T> implements HasValue {
        @Override
        public void setValue(Object o) {
            super.setValue((T) o);
        }

        @Override
        public Registration addValueChangeListener(ValueChangeListener valueChangeListener) {
            return super.addValueChangeListener(componentEvent ->
                    valueChangeListener.valueChanged(new ValueChangeEvent<Object>() {
                        @Override
                        public HasValue<?, Object> getHasValue() {
                            return null;
                        }

                        @Override
                        public Object getOldValue() {
                            return null;
                        }

                        @Override
                        public boolean isFromClient() {
                            return componentEvent.isFromClient();
                        }

                        @Override
                        public Object getValue() {
                            return ExtendedAutosuggest.super.getValue();
                        }
                    })
            );
        }
    }

}

Thanks for that. One question because it looks like there is no possibility to provide custom value (although there is a custom listener), each time custom value is being cleared out from the field allowing to provide only the value from initial/lazy list.