wbadam / autocomplete-extension

Autocomplete extension add-on for Vaadin 8
https://vaadin.com/directory#!addon/autocomplete-extension
8 stars 7 forks source link

New functionality #2

Closed FLecorps closed 7 years ago

FLecorps commented 7 years ago

Hi,

As a new valuable functionality, I would suggest to implement a Listener/Callback/Method to be called when the user just selected an item in the auto-complete list.

It would allow to "synchronize" some actions with the autocomplete itself.

or maybe there is still a way to do that?

Thanks again for your great work (you fixed the first issue nearly faster than the time I had to submit it :-),

Regards, Fred

wbadam commented 7 years ago

Hi,

The way you can do that is to listen to value change events on the text field. textField.addValueChangeListener(...)

It's now unreliable though, it's fired after blur or a keypress. I'll make this event fire right after selection, that's the way it should work anyway. ValueChangeEvent has the old and the new value and if the change was user originated.

Do you have a use case where it would be better to have a separate event instead? There is not much extra information on the client about the list items other than the value and the displayed text. What do you think the event should contain?

FLecorps commented 7 years ago

Hi,

I just tested you fix, and it's perfectly working. Your solution fits our requirements and I think there is no need to implement a special event for that.

Thanks for your efforts & keep up the good work!

wbadam commented 7 years ago

Hi, that's great, then I'll create a release out of that fix right away.

Thank you for the interest, feel free to add improvement suggestions or issues in the future as well!