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.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Filtered combo: selection cleared if using mouse.
Hello
I am using a filtered combox - I am using the code as outlined in this blog post.blog.oio.de/2015/01/17/write-simple-auto-complete-combobox-vaadin/
Case 1 : Use the keyboard
- entering the text and use the up and down arrows to highlight and enter to select and then use the tab key to leave the field . The value change listener is fired the field selection registered and the value set adn visible in the combo box.
Case 2: Use the mouse.
- entering the text and mouse to select and then either use the tab key or the mouse to leave the field . The value change listener is fired the field selection registered and the value set BUT ITS IS deleted from the combo box.
I have tried the combobox wrapped in a form layout and no change.
No other events are fired.
I am using 6.8.3
I have spent all day yesterday trying to fix this problem. This morning I thought go ask those nice Vaadin community people.
And I then try something completely different and I get it to work - doh!
1. My combobox is using a datasource which extends a BeanItemContainer.
2. As the user types a name the container lazy loads based on the text and adds lots of beans to the filter.
3. In the value change listener for the combobox I get the bean from the event and pass it to the container (As described in the linked article).
4. However in the container I do the following:
In the SuggestionsFIlter:.....
public void setSelectedBean(PeopleBean value) {
log.info("Setting people filter.");
// removeAllItems();
addBean(value);
p = value;
}
In the container itself:....
private void filterItems(String filterString) {
removeAllItems();
if (p!=null){ addItem(p); }
if (filterString.length() > 3) {
List<GpiPeople> people = db.findByName(filterString);
log.info("Searching for people with name "+filterString+" - "+people.size()+" found.");
for (GpiPeople p : people) {
addItem(new PeopleBean(p.getPplId(), p.toString(), p));
}
}
}
I do not understand why this works but it does for both keyboard and mouse I am know a happy bunny. If anyone is interested in the full code let me know.