ComboBox return list vaadin 14 [Object object]

I am trying to populate a simple combobox in flow and am getting a list of [Object object]
:


@Id("cbxCodCliente")
private ComboBox<Cliente> cbxCodCliente;

cbxCodCliente.setItemLabelGenerator(Cliente::getNome);
List<Cliente> listClientes = new ArrayList<Cliente>();
listClientes = prodService.listaClientes();
cbxCodCliente.setItems(listClientes);
	

thanks.
17923047.png

Have you selected one once? I believe the itemLabelGenerator is only used for the selected value. Use comboBox.setRenderer(...) for the options instead. Using only a renderer will in turn not apply it to the selected value. So you should define both.
ComboBox can only display a String for the selected value, which is defined with the itemLabelGenerator. but you can display any kind of vaadin-components using a ComponentRenderer, or use any other implementation of Renderer like maybe a TemplateRenderer
In contrast, the [Select component]
(https://vaadin.com/components/vaadin-select/java-examples) of Vaadin will apply its renderer to the selected value too - no need for an itemLabelGenerator there.

cbxCodCliente.setItemLabelGenerator(Cliente:getNome);
cbxCodCliente.setRenderer(new ComponentRenderer<>(item -> new Span(item.getNome())));

Kaspar,

It works that way.

Thank you very much.