Cannot update the Current Caption of ComboBox
There is no way to provoke the change of the caption of the Current ComboBox value
ListDataProvider<String> dataProvider = new ListDataProvider<>(Arrays.asList("one", "two", "three"));
ComboBox<String> comboBox = new ComboBox<>();
comboBox.setWidth(250, Unit.PIXELS);
comboBox.setDataProvider(dataProvider);
comboBox.setItemCaptionGenerator(item -> item + " - " + String.valueOf(System.currentTimeMillis()));
layout.addComponent(comboBox);
Button button = new Button("Refresh");
button.addClickListener(event -> dataProvider.refreshItem(comboBox.getValue()));
layout.addComponent(button);
The workaround is:
comboBox.setItemCaptionGenerator(comboBox.getItemCaptionGenerator());
because that's call the private ComboBox.updateSelectedItemCaption() method
I have the same problem, but the workaround doesn't work for me....the only difference is that I binded the combobox. The only way for refresh the caption of selected item is set value to null and then to the real value, with the conseguence to fire a change state event of the binder.
Cristian
Up
I can not reproduce the issue with latest master. Probably fixed together with something else. I am closing the ticket, let me us know if you have any other broken code example.
I can not reproduce the issue with latest master. Probably fixed together with something else. I am closing the ticket, let me us know if you have any other broken code example.
Very strange because the bug is still present. When you select a ComboBox item and click on "Refresh button", the text shown in the combobox (the current value) is automatically updated?
@anasmi @elmot I think it's necessary to re-open this bug
Hi Pierre,
I have checked the behaviour and it seems working to me:
- Select the value in CB
- Click Refresh
- Value is updated
I have used the code from your original message. What version are you using? This is master branch of the framework(8.7-SNAPHOT), but I recall testing at the same time as @elmot did and it worked back then also, so should be fixed at 8.6.0 as well.

Hi,
I had to test that on the wrong version. Sorry for the inconvenience
Thanks,
No problem! : )
It's always better to double check
I have just found this issue because I had the same problem. It seems like the issue is fixed for refreshItem(T) but not for refreshAll().
Is it intendet that refreshItem(T) refreshes some more that refreshAll()?
For me it was not intuitive.