java - Primefaces DataTable display only the last item -


the datatable displaying last item added, seems every time press commandbutton method rewrites list, can avoid that?

jsf

 <p:commandbutton  action="#{productobean.setpedidoactual()}" value="agregar" update="dt"/>          </p:panelgrid>         <p:datatable value="#{productobean.pedidoactual}" var="pedi">             <p:column headertext="nombre">                                   <h:outputtext  value="#{pedi.descripcion}"/>             </p:column>         </p:datatable>   

bean

public void setpedidoactual() {      producto pro = productofacade.find(idproducto);          listpedidoactual.add(pro);  }  public list<producto> getpedidoactual() {      return listpedidoactual; } 

your setpedidoactual() method seems receive 1 item based on facade service find(idproducto), correct? have checked remote service returns? there in fact 1 record.

beside that, try rename setter/getter from

getpedidoactual() / setpedidoactual()

into

getlistpedidoactual() setlistpedidoactual()

now method names consistent attribute.

edit: happened panelgrid tag? have purposely omitted or start?


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -