1
Hello, I’m having trouble updating the table after removing some item from it, the item just removed from the table definitely when looking for another type.
The table updates as the value of selects in selectOneMenu
.
locationPorType.xhtml
<h:form id="formPrincipal">
<ui:include src="/WEB-INF/Template/tabelaLayout.xhtml" />
<p:panelGrid columns="1"
style="padding-left: 100px; padding-right: 100px;">
<h:panelGroup>
<p:outputLabel value="Tipo: " />
<p:selectOneMenu
valueChangeListener="#{leiMunicipalMB.colecaoTipo}">
<f:selectItem itemLabel=" - Selecione um tipo - " itemValue="#{null}" />
<f:selectItems value="#{leiMunicipalMB.tiposLeis}" var="item"
itemValue="#{item.codigo}" itemLabel="#{item.descricao}" />
<p:ajax update="tabLeisMunicipais" />
</p:selectOneMenu>
</h:panelGroup>
<p:dataTable id="tabLeisMunicipais" var="lei"
value="#{leiMunicipalMB.leisFiltrarPorTipo}"
emptyMessage="Nenhuma lei." widgetVar="tabLeisMunicipais"
reflow="true"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
rowsPerPageTemplate="5,10,15" paginatorPosition="bottom"
paginator="true" rows="10">
..COLUMNS..
<p:column style="size: 50px;">
<p:commandButton id="btnAlterar"
icon="fa fa-pencil-square-o fa-1x"
action="#{leiMunicipalMB.recebendoLei()}"
update=":frmAlterar:panelAlterar"
oncomplete="PF('alterarLei').show()" ajax="true">
<f:setPropertyActionListener
target="#{leiMunicipalMB.leiMunicipal}" value="#{lei}" />
</p:commandButton>
<p:commandButton id="btnExcluir" icon="fa fa-trash fa-1x"
update=":frmExcluir:panelExcluir"
oncomplete="PF('excluirLei').show()">
<f:setPropertyActionListener
target="#{leiMunicipalMB.leiMunicipal}" value="#{lei}" />
</p:commandButton>
<p:commandButton id="btnVisualizar" icon="fa fa-search fa-1x"
update=":frmVisualizar:panelVisualizar"
oncomplete="PF('visualizarLei').show()" ajax="true">
<f:setPropertyActionListener
target="#{leiMunicipalMB.leiMunicipal}" value="#{lei}" />
</p:commandButton>
</p:column>
</p:dataTable>
</p:panelGrid>
</h:form>
modalPanel.xhtml
<p:dialog id="excluirDlg"
header="Deseja realmente excluir o item abaixo?" widgetVar="excluirLei"
modal="true" width="auto" draggable="true" location="center" responsive="true">
<h:form id="frmExcluir">
<h:panelGrid id="panelExcluir" columns="2" cellpadding="5">
OutputLabels
<h:panelGroup>
<p:commandButton id="btnSim" value="Sim"
action="#{leiMunicipalMB.excluirLei}"
update="formPrincipal"
onclick="PF('excluirLei').hide()">
<f:setPropertyActionListener
target="#{leiMunicipalMB.leiMunicipal.codigo}"
value="#{leiMunicipalMB.leiMunicipal.codigo}" />
</p:commandButton>
<p:commandButton id="btnNao" value="Não"
onclick="PF('excluirLei').hide()" ajax="true" />
</h:panelGroup>
</h:panelGrid>
</h:form>
</p:dialog>
Don’t say thanks, don’t say hello to questions, look what kind of behavior is expected from users? and [Mre]
– gleisin-dev