Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vaadin 8 ComboBox does not show empty selection caption in selected value #9079

Closed
ericcournarie opened this issue Apr 13, 2017 · 2 comments
Closed
Milestone

Comments

@ericcournarie
Copy link

When trying to use a ComboBox, I tried to set the empty selection caption with the followings

setEmptySelectionAllowed(true);
setEmptySelectionCaption("My empty caption");

The empty caption appears well in the Combobox menu, but once selected, the selected field value is always blank, whatever I did. And setting it programmatically with setValue (null) does not make it appear

I check the setItemCaptionGenerator, but my lambda expression is not called with a null value.

sample code:

       ComboBox<String> cb = new ComboBox<>();
       cb.setEmptySelectionAllowed(true);
       cb.setEmptySelectionCaption("nobody");
       cb.setItems("John", "Bob", "Barry");
       cb.setValue(null);
       cb.setItemCaptionGenerator(f -> (f == null) ? "nobody by caption" : f);

I'm using version 8.0.5

@tsuoanttila
Copy link
Contributor

This is a behaviour change from Vaadin 7, where you had a "null item" in your container, that acted as the empty selection. Now with Vaadin 8, there's no null item. And it seems that the empty selection caption is indeed not being displayed correctly. I need to consult our UX guys on how it should behave.

@tsuoanttila
Copy link
Contributor

This was picked to 8.0.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants