Update in an off-tab dialog

Asked

Viewed 29 times

0

Hello Everyone I am trying to update to appear a dialog dlgPagamentos and does not appear when clicking the search button.

<p:dataTable id="tabelaPagamentos" var="pagamentoAux" widgetVar="tabelaPagamentosWdg"
            value="#{criticaIncorparacaoPagamento.bean.pagamentos}"
            paginator="true" rows="5" style="width: auto; height: auto; margin:6px auto;"
            paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
            rowsPerPageTemplate="5,10,15">

<p:column headerText="Código de Barras" style="text-align: left; white-space: nowrap;">
    <h:outputText value="#{pagamentoAux.codgBarraPagamento}" />
</p:column>

<p:column headerText="Autênticação" style="text-align: left; white-space: nowrap;">
    <h:outputText value="#{pagamentoAux.numrAutenticacaoBancaria}" />
</p:column>

<p:column headerText="Data Pagamento" style="text-align:center; white-space: nowrap;">
    <h:outputText value="#{pagamentoAux.dataPagamentoBanco}">
        <f:convertDateTime pattern="dd/MM/yyyy HH:mm" locale="pt_BR" timeZone="GMT-3" />
    </h:outputText>
</p:column>                        

<p:column headerText="Valor Pagamento" style="text-align: right; white-space: nowrap;" >
    <h:outputText value="#{pagamentoAux.valorRecebidoPagamento}" > 
        <f:convertNumber pattern="###,##0.00" />
    </h:outputText>
</p:column>

<p:column  headerText="Agência Arrecadadora" style="text-align: left; width: 250px;">
    <h:outputText value="#{pagamentoAux.agenciaBancaria.nomeAgencia eq null ? pagamentoAux.codgAgenciaBancaria : pagamentoAux.agenciaBancaria.nomeAgencia }" />
</p:column>                                                            

</p:dataTable>


</p:dialog>  

<p:growl id="growlMessage" sticky="false" life="6000"
    globalOnly="true" autoUpdate="true" /> 

<!--Aba de Pesquisa de Pagamentos-->

<p:tab  title="Pesquisa de Pagamentos" id="tabPesquisaPagtos">
<!--                            <p:fieldset style="text-align: left" legend = "Dados do Pagamento">-->

<p:panel style="text-align: center; width: 40%">                                              
<div style="text-align: left">
    <p:panelGrid id="painelCamposPesquisaPag">                                                       
        <p:row>
            <p:column style="text-align: center">
                <h:outputText value="*Banco: " style="vertical-align: middle; text-align: center" />        
            </p:column>
            <p:column>
                <p:autoComplete size="50" id="bancoAutoComplete" value="#{criticaIncorparacaoPagamento.bean.banco}" completeMethod="#{criticaIncorparacaoPagamento.pesquisaBanco}"
                                var="banco" itemLabel="#{banco.codigoBanco} - #{banco.nomeBanco}" itemValue="#{banco}" converter="genericConverter" forceSelection="true" scrollHeight="200">
                    <p:ajax event="itemSelect" listener="#{criticaIncorparacaoPagamento.listarAgencias}" update="agenciaAutoComplete" process="@this"/>
                    <p:column style="width: 10%">
                        <h:outputText value="#{banco.codigoBanco}" />
                    </p:column>

                    <p:column>
                        <h:outputText value="#{banco.nomeBanco}" />
                    </p:column>
                </p:autoComplete>
            </p:column>          
        </p:row>

        <p:row>
            <p:column style="text-align: center">
                <h:outputText value="Agência: " style="vertical-align: middle" />
            </p:column>                                                           
            <p:column>
                <p:autoComplete size="50" id="agenciaAutoComplete" value="#{criticaIncorparacaoPagamento.bean.agencia}" completeMethod="#{criticaIncorparacaoPagamento.pesquisaAgencia}"
                                var="agencia" itemLabel="#{agencia.nomeAgencia}" itemValue="#{agencia}" converter="genericConverter" forceSelection="true" scrollHeight="200">
                    <p:ajax event="change" process="@this"/>
                    <p:column style="width: 10%">
                        <h:outputText value="#{agencia.codigoAgencia}" />
                    </p:column>

                    <p:column>
                        <h:outputText value="#{agencia.nomeAgencia}" />
                    </p:column>
                </p:autoComplete>
            </p:column>                                                           
        </p:row>

        <p:row>
            <p:column style="text-align: right">
                <h:outputLabel value="*Data Pagamento:  " />
            </p:column>
            <p:column>
                <h:panelGroup>

                    <p:calendar id="dataInicial" showOn="button" size="16"
                                readOnlyInputText="true"
                                navigator="true"
                                pattern="dd/MM/yyyy"  locale="pt_BR" timeZone="GMT-3"
                                value="#{criticaIncorparacaoPagamento.bean.dataInicial}" />

                    <h:outputLabel value=" a  " />

                    <p:calendar id="dataFinal" showOn="button" size="16"
                                readOnlyInputText="true"
                                navigator="true"
                                pattern="dd/MM/yyyy"  locale="pt_BR" timeZone="GMT-3"
                                value="#{criticaIncorparacaoPagamento.bean.dataFinal}" />
                </h:panelGroup>
            </p:column>
        </p:row>
        <p:row>
            <p:column style="text-align: center">
                <h:outputLabel value="Autenticação:  " />
            </p:column>
            <p:column >
                <p:inputText value="#{criticaIncorparacaoPagamento.bean.txtAutenticacaoPesq}" size="40" maxlength="40" />
            </p:column>
        </p:row>
        <p:row>
            <p:column style="text-align: center">
                <h:outputLabel value="Valor:  " />
            </p:column>
            <p:column>
                <p:inputText style="text-align: left" id="valorPagamento" value="#{criticaIncorparacaoPagamento.bean.txtValorPagamentoPesq}" onkeydown="mascara(this, valor);"/>
            </p:column>
        </p:row>
    </p:panelGrid>
</div>
<p:spacer width="10px" />
<div align="center">
    <p:toolbarGroup align="left"
                    style="text-align: left;">                                       

        <p:commandButton style="width: 100px;" 
                            value="Limpar"
                            action="#{criticaIncorparacaoPagamento.limpaCamposPesquisaPag}"
                            update="painelCamposPesquisaPag" />                                                    
        <p:spacer width="30px" /> 

        <p:commandButton style="width: 100px;"                                                
                            value="Pesquisar"
                            action="#{criticaIncorparacaoPagamento.buscarPagamentos}"                                                            
                            update=":frmCritica:tabConsultas:dlgPagamentos"
                            oncomplete="dlgPagamentos.show();" process="@form" />


    </p:toolbarGroup>
</div>

</p:panel>
<!--                            </p:fieldset>-->
</p:tab> 

1 answer

0

When a dialog in the Primefaces versions greater than 4, the call of the dialog is made differently from what you are using, I believe your problem is that.

Change that command:

oncomplete="dlgPagamentos.show();"

For that:

oncomplete="PF('dlgPagamentos').show();"

I hope this solves your problem.

  • I tested using this call in the top version only it didn’t work.

  • Requestcontext context = Requestcontext.getCurrentInstance(); context.execute("dlgParts.show();");

  • Inside my method in the controller I make this call when executing the search method on the button.

  • Hello Emerson, put the complete code, because this missing the beginning of the dialog, another thing, declares the dialog after your call code, once was having problem with the dialog of the first faces and do not know why, but after I declared it at the end of the code it worked.

  • Hello Edjane, solved the problem, the question that my daliog was inside my call code inside a tab. I realized that she is an external compote has to be called off. Thanks for the thanks say.

  • I’m glad you solved Emerson!

Show 1 more comment

Browser other questions tagged

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