After registration, datatable is not updated

Asked

Viewed 172 times

0

I have a problem where after registering 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 registration screen is a dialog and the idea is that when you click the Save dialog button closes (it works) and inserts the record into the dataTable without 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 solve ?

1 answer

0

Try it like this

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

Browser other questions tagged

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