p: selectOneMenu does not update value inside ui: repeat

0

The context is as follows, I have a list of objects AvaliaProjeto , which contains:

  • Project
  • Criteria
  • Scale
  • Value

The project is selected from the outside, the criteria are listed for their scales to be chosen. That is, each AvaliaProjeto object contains a relation between scale and criterion.

I created this dialog to register AvaliaProjeto (which is actually a sequence of evaluations), but ready the criteria and their potential scales via ui:repeat . The problem is that at the time of registering, Escala attributes are null.

Below are POJO, View and Print dialogs.

VIEW

<table id="table">
    <tr>
        <td><h:outputText value="Critério"
                class="componentePF label bold" /></td>
        <td><h:outputText value="Valor Numérico"
                class="componentePF label bold" /></td>
        <td><h:outputText value="Valor ou Impacto"
                class="componentePF label bold" /></td>
    </tr>

    <ui:repeat var="a" value="#{topsisBean.avaliaProjetosPD}">
        <tr>
            <td><h:outputText value="#{a.criterio.nomeCriterio}"
                    class="componentePF label" /></td>

            <td><p:selectBooleanCheckbox /></td>

            <td><p:selectOneMenu converter="generic" value="#{a.escala}"
                    class="componentePF text">
                    <f:selectItem itemLabel="Escolha um Impacto de Escala"
                        itemDisabled="true" noSelectionOption="true" />
                    <f:selectItems value="#{topsisBean.escalas}" var="e"
                        itemLabel="#{e.impactoEscala}" itemValue="#{e}"
                        converter="generic" />
                </p:selectOneMenu></td>
        </tr>
    </ui:repeat>
</table>

POJO

@Entity
@Table(name="avaliaprojeto", schema="somore")
public class AvaliaProjeto implements Serializable, SampleEntity {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private int idAvaliaProjeto;

    @OneToOne
    @JoinColumn(name="idProjeto")
    private Projeto projeto;

    @OneToOne
    @JoinColumn(name="idCriterio")
    private Criterio criterio;

    @OneToOne
    @JoinColumn(name="idEscala")
    private Escala escala;

    double valorCriterio;
//gets sets equals e hash
}

Print

Anyone with any idea what the problem was?

    
asked by anonymous 15.06.2015 / 00:43

1 answer

1

After a lot of head-shuffling, I searched the English stackoverflow and found that it has problems with nested components for data collection. Being just for presentation works well.

Replace with datatable.

    
16.06.2015 / 19:49