Problem using Dialog Prime Faces

Asked

Viewed 665 times

1

Good night, I’m developing a simple CRUD using JSF, but I’m having trouble using Prime Faces functions. I want to make the insertions, changes and exclusions through Dialogs...but so far I could not use the functions...the dialog does not appear on the screen. Apparently Bean’s methods aren’t working. I can access Bean’s methods and apparently I was able to map id of form that’s inside the dialog, in the attribute update.But I couldn’t access the dialog using oncomplete="dialogGerLivro.show()"

Bean class

@Named
@SessionScoped
public class ListaController implements Serializable {

@Inject
private ListaDAO dao;
private Lista lista;

public Lista getLista() {
    if (lista == null) {
        lista = new Lista();
    }
    return lista;
}

public void setLista(Lista lista) {
    this.lista = lista;
}

public void adicionar() {
    lista = new Lista();
}

Page . xhtml

 <h:form id="formLista">

        <p:commandButton value="Adicionar Lista" actionListener="#{listaController.adicionar()}" update=":formLista:formDados:painelDadosLista" oncomplete="dialogGerLivro.show()"/>

      //DataTable

        <p:dialog header="Gerencia de Livro" widgetVar="dialogGerLivro">
            <h:form id="formDados">
                <h:panelGrid  id="painelDadosLista" columns="2" style="margin-bottom:10px">

                    <h:outputLabel for="titulo" value="Título:" />
                    <h:inputText id="titulo" value="#{listaController.lista.titulo}"/>


                </h:panelGrid>
            </h:form>
        </p:dialog>
    </h:form>

1 answer

3

From version 4.1 of Primefaces it is necessary that you use the following syntax: PF('widgetVar').show(), where widgetVar is the name of the dialog you want to display.

Browser other questions tagged

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