Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
ComboBox: blank text input prompt after selecting an item
I don't really know if this post belongs to UI subforum (or even Data Binding), because the problem could be due to one of those aspectes.
I'm using a ComboBox that is bind to an SQLContainer. It displays a series of items coming from a table (all the available options). This component is part of a form that collects some other data, and then its kept in its own database table, so the selected ComboBox "item id" is saved as a foreign key.
After struggling on how to accomplish this, pulling my head trying to understend how StatementDelegates work, implementing RowIdToIntegerConverter to be able to use the selected item id back in my UPDATE query, getting the saved value as the default selected one when user opens the form for editing, and becoming as bald as Chiquito de la Calzada looks in my avatar picture, I almost solved all problems, but now I'm experiencing what it looks like a Vaddin bug to me.
When I click in one item of the dropdown, instead of seeing it as the current selected one in the ComboBox "field", I see an empty space and the blinking cursor waiting me to prompt some text, as ready for accepting some text for filtering the dropdown results list. But the value is definitly selected -- if I click elsewhere in the screen, suddenly the input prompt disappears and it's filled with the real selection I made seconds ago. If I click on my "Save/update data" button, it gets properly saved.
This behaviour doesn't happen it I don't have a FieldGroup binder bind to my ComboBox, a default selected ComboBox.select(rowIdToSelect) item and a ComboBox.setConverter(whateverConverter) converter applied to it (which is the order I'm doing things in order to accomplish my purposes; otherwhise it won't work). That is: if I simply attach my SQLContainer datasource to my combobox, items are displayed and selection can be made without this disturbing behaviour.
Am I doing something wrong? Or maybe is this a Vaadin bug instead?
Hi Pere, did you resolve this problem? I'm having the same problem.