What to do when a <p:dialog> closes in less than a second?

Asked

Viewed 152 times

1

I’m creating one to edit a client’s database. It loads the data with the values of the attribute of the object passed, but in less than a second it closes again. What to do?

XHTML code (client datatable):

<p:dataTable id="clientes" value="#{clienteMB.clientes}" var="item">

                <p:column headerText="CNPJ" style="text-align: center">
                    <h:outputLabel value="#{item.cnpj}" />
                </p:column>

                <p:column headerText="Razão Social" style="text-align: center">
                    <h:outputLabel value="#{item.razao_social}" />
                </p:column>

                <p:column style="width:40px;text-align: center">
                     <p:commandButton icon="ui-icon-pencil" onclick="PF('new_cliente').show()"
                        title="Editar" update=":new_cliente">
                        <f:setPropertyActionListener value="#{item}" target="#{clienteMB.cliente_aux}"/>
                        <ui:param name="var_cnpj" value="#{clienteMB.cliente_aux.cnpj}"/>
                        <ui:param name="var_razao" value="#{clienteMB.cliente_aux.razao_social}"/>
                     </p:commandButton>                              
                </p:column>

                <p:column style="width:40px;text-align: center">
                     <p:commandButton icon="ui-icon-trash" action="#{clienteMB.deletaCliente(item.cnpj)}"/>
                </p:column>

                <p:column style="width:40px;text-align: center">
                     <p:commandButton icon="ui-icon-bookmark" action="#"/>
                </p:column>

            </p:dataTable>

XHTML code (client change dialog):

<p:dialog id="new_cliente" header="Dados do Usuário" widgetVar="new_cliente" width="400" modal="false" resizable="false">  
            <h:panelGrid columns="2">  
                    <h:outputLabel value="CNPJ: " />  
                    <h:inputText value="#{var_cnpj}" />  
                    <h:outputLabel value="Razão Social: " />  
                    <h:inputText value="#{var_razao}" />  
             </h:panelGrid> 
    </p:dialog>
  • Opa, um dúvida, por que utilizar no commandButton o onclick="PF('new_cliente'). show()" para exibir e juntamente o update=":new_cliente"? Will the update update update the modal data itself or do you have any other components with id="new_client"? Maybe that’s all the mistake. If so, please let us know that you have put your question as an answer.

No answers

Browser other questions tagged

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