Show itemLabel instead of an ivemValue in DataTable - JSF, Primefaces

0

Well, I'm working on a project and when saving a record using the selectOneMenu of primefaces, an Id is displayed instead of the field name that was selected, I need to know how to display only the field name.

Here's my xhtml:

<p:outputLabel for="tipoTratamentoCB" value="Tipo de tratamento:" />
                <p:selectOneMenu id="tipoTratamentoCB"
                    value="#{guiaEncaminhamentoBean.guiaEncaminhamento.tipoTratamentoCB}"
                    style="width:185px">
                    <f:selectItem itemLabel="Hospitalização Diurna - HD" itemValue="0" />
                    <f:selectItem itemLabel="Hospitalização Noturna - HN" itemValue="1" />
                </p:selectOneMenu>

My CBRC type variable is declared to be so in my class:

private String tipoTratamentoCB;

The problem is that I display in my xhtml the value that is saved in ivemValue in selectItem, I need to know how to display the value of the itemLabel, does anyone have any idea how to do this?

    
asked by anonymous 04.05.2016 / 16:27

1 answer

0

If I understand correctly, you want to store the value of the itemLabel in typeCB. If this is the case, try changing the following:

<f:selectItem itemLabel="Hospitalização Diurna - HD" itemValue="Hospitalização Diurna - HD" />
<f:selectItem itemLabel="Hospitalização Noturna - HN" itemValue="Hospitalização Diurna - HD" />
    
12.12.2016 / 20:40