After registration, datatable is not updated

0

I have a problem where after registration my dataTable is not updated. My button:

<p:commandButton value="#{msg['salvar']}" action="#{encomendaController.salvar}"
                update="@form,:listaEncomendas:messages,:listaEncomendas:viewFull:resultadoPendentes,msgAtualizacao"
                oncomplete="PF('cadastroEdicao').hide();"/>

My dataTable:

<p:dataTable id="resultadoPendentes" rows="10" paginator="true" value="#{encomendaController.encomendas}" var="bean"
                        paginatorPosition="top" style="display: #{empty encomendaController.encomendas ? 'none' : ''};">
                        <p:column styleClass="botoesGrid">
                            <p:commandButton styleClass="bb" icon="ui-icon-pencil" action="#{encomendaController.editar(bean)}"
                                update=":listaEncomendas:viewFull:cadastroEdicaoForm:cadastro,resultadoPendentes,:listaEncomendas:viewFull:cadastroEdicaoForm:dlgTitle"
                                process="@this" onclick="PF('cadastroEdicao').show();" />
                            <p:commandButton icon="ui-icon-trash" action="#{encomendaController.excluir(bean)}" process="@this"
                                update="resultadoPendentes,:listaEncomendas:viewFull:cadastroEdicaoForm:msgAtualizacao" title="#{msg['remover']}">
                                <p:confirm header="#{msg['cabecalho.apagar.registro']}" message="#{msg['apagar.registro']}" icon="ui-icon-alert" />
                            </p:commandButton>
                            <p:confirmDialog global="true" showEffect="exploud" hideEffect="fade">
                                <p:commandButton value="#{msg['sim']}" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
                                <p:commandButton value="#{msg['nao']}" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
                            </p:confirmDialog>
                            <p:commandButton icon="ui-icon-info" title="Mais" />
                        </p:column>
                        <p:column headerText="Código">
                            <p:outputLabel id="codigoGrid" value="#{bean.codigo}" />
                        </p:column>
                        <p:column headerText="Local">
                            <p:outputLabel value="#{bean.local}" />
                        </p:column>
                        <p:column headerText="Situação Atual">
                            <p:outputLabel value="#{bean.evento}" />
                        </p:column>
                        <p:column headerText="Data/Hora Evento" style="text-align:center;">
                            <p:outputLabel value="#{bean.horaEvento}" rendered="#{bean.evento != 'Sem registros do Objeto no momento.'}">
                                <f:convertDateTime pattern="dd-MM-yyyy HH:mm" />
                            </p:outputLabel>
                        </p:column>
                    </p:dataTable>

My signup screen is a dialog and the idea is that when clicking on the Save dialog button closes (this works) and inserts the record in dataTable without giving load. In my save method I search the records again but the new one is not inserted automatically, ie I need to give F5 to see it. Does anyone know how I can resolve?

    
asked by anonymous 04.09.2017 / 17:56

1 answer

0

Try this way

<p:commandButton value="#{msg['salvar']}" action="#{encomendaController.salvar}" ajax="true"
update="@form,:listaEncomendas:messages,:listaEncomendas:viewFull:resultadoPendentes,msgAtualizacao"
oncomplete="PF('form').hide(); #{seuMB.bean}"/>
    
25.09.2017 / 16:31