0

I would like to use SelectOneMenu with PrimeFaces or BootsFaces and fill it with JPA. My problem is: when I update the data, SelectOneMenu does not have the correct item selected.

But if I use normal JSF (h:selectonemenu) it works.

enter image description here

It's my first question and I speak spanish, sorry for my bad english.

I attach an image using selectonemenu with normal JSF h:selectonemenu and not PrimeFaces or BootsFaces.

Code with JSF h:selectonemenu it works but not using PrimeFaces and BootsFaces

<h:selectOneMenu value="#{pEDbean.consolidator.codigoPO}">
    <f:selectItems value="#{poaBean.listPoaSA}" var="poa1" itemLabel="#{poa1.actividad}" itemValue="#{poa1.codigopo}">
    </f:selectItems>
</h:selectOneMenu>

Option in datatable for getting value and update form where selectonemenu is

<p:contextMenu for="tabla1">
    <p:menuitem value=" Editar avances" icon="fa fa-edit" ajax="true" update="form1" action="#{pEDbean.obtenerupdateped()}" onclick="intermittentButton()"/>
    </p:contextMenu>

It's a function in beanconsolidator

public void obtenerupdateped() {
    try {            
        this.consolidator = consoOb;                                  
        this.comentario1 = this.consoOb.getComentario();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

With BootsFaces value's selectonemenu has to be an object and not a int or String (value="#{pEDbean.consolidator.codigoPO}")

<p:selectOneMenu value="#{pEDbean.consolidator.codigoPO}">
    <f:selectItems value="#{poaBean.listPoaSA}" var="poa1" itemLabel="#{poa1.actividad}" itemValue="#{poa1.codigopo}">
    </f:selectItems>
</p:selectOneMenu>

I want to use PrimeFaces or BootsFaces because they have a filters in selectonemenu and more features.

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102

0 Answers0