p:selectOneMenu does not update value within ui:repeat

Asked

Viewed 227 times

0

The context is the following, I have a list of objects AvaliaProjeto, containing:

  • Project
  • Discretion
  • Stopover
  • Valor

The project is selected from the outside, the criteria are listed so that their scales are chosen. That is, each object AvaliaProjeto contains a relationship between scale and criterion.

I created this dialogue to register AvaliaProjeto (which is actually a sequence of evaluations), however, I list the criteria and their potential scales via ui:repeat. The problem is that when registering, the attributes Escala are void.

Below are POJO, View and Print dialogue.

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

inserir a descrição da imagem aqui Anyone with any idea what the problem was?

1 answer

1

After a lot of head-breaking, I researched stackoverflow in English and found that has problems with nested components for data collection. Being only for presentation works well.

Replaces with datatable.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.