0

I´m just trying to get some object when I do double click over a data table row and show it on a modal dialog. I should be missing something because it does it correctly only one time. After the bean object is setted, it keeps the value no matter what I do.

Here is the code:

*.xhtml:

    <!-- Modal dialog -->
    <p:dialog widgetVar="addNotDlg" id="idAddNotDlb" minHeight="40" modal="true"
        resizable="false" draggable="false" style="heigth:500">

            <p:panel id="panel">
                <p:messages id="messages" />
                <h:panelGrid columns="3" cellpadding="5">

                    <p:outputLabel for="resultado" value="Resultado:" />
                    <p:inputText id="resultado"
                        value="#{acuerdoBean.notificacion.resultado}" label="resultado" />
                    <p:message for="resultado" />

                    <p:outputLabel for="motivo" value="Motivo:" />
                    <p:inputText id="motivo"
                        value="#{acuerdoBean.notificacion.motivo}" label="motivo" />
                    <p:message for="motivo" />

                </h:panelGrid>

                <p:commandButton value="Guardar" id="addNewNotButton" actionListener="#{acuerdoBean.addNotificacion()}" 
                    update=":formNotificacion:notificacionesTable"
                    oncomplete="handleLoginRequest(xhr, status, args)" />
                <p:commandButton value="Cerrar" id="closeNewNotButton" onclick="PF('addNotDlg').hide();" />
                <h:outputText value="" />
            </p:panel>


    </p:dialog>

*Bean.java code:

public void generateNewNotificacion() {
    this.tiposNotificaciones = pservice.getTiposNotificaciones();       
    this.tipoNotificacion = new Rstiponotifica();   
    this.direccionPorDefecto = (Rsdireccion) pservice.findDireccionPorDefecto();

    this.notificacion = new Rsnotificacion();
    this.notificacion.setRsacuerdo(acuerdo);
    this.notificacion.setRstiponotifica(tipoNotificacion);  
    this.notificacion.setRsdireccion(direccionPorDefecto);
}

The above function is executed in other .xhtml file event. I would expect that my "this.notificacion" object should appear as new in the modal, but it doesn´t. The "this.notification" object was setted previously and it remains in memory.

<p:commandLink onclick="PF('addNotDlg').show();" actionListener="#{acuerdoBean.generateNewNotificacion()}">
    <h:outputText value="Añadir nueva notificacion" />
</p:commandLink>

Thanks in advance.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
juanmorschrott
  • 573
  • 5
  • 25

1 Answers1

1

Updating your panel inside the dialog when you click the command link should fix your problem. The commandLink have an update attribute that you can use.

You can see a working example on primefaces website : http://www.primefaces.org/showcase/ui/data/schedule.xhtml

Dimpre Jean-Sébastien
  • 1,067
  • 1
  • 6
  • 14