1
I am trying to realize a logic of effecting the export button excel
is disabled by clicking the search button if the number of records is equal to zero. The problem is that the first time it works normal, but the second time the button is no longer rendered again.
<f:facet name="footer">
<p:row>
<p:column style="text-align: right" colspan="4">
<p:commandButton id="bt_filtrar" value="#{lbl['BOTAO.FILTRAR']}" process="filtro" actionListener="#{propostaCartaoListBean.buscar}" update="tabela br_exportar"/>
<p:commandButton id="bt_limpar" icon="botaoLimpar" title="#{lbl['BOTAO.LIMPAR']}"/>
<p:commandButton id="bt_exportar" icon="botaoExcel" ajax="false" disabled="#{propostaCartaoListBean.lazyModel.rowCount == 0}" title="#{lbl['BOTAO.EXPORTAREXCEL']}">
<p:dataExporter type="xls" target="tabela" fileName="propostaCartao" />
</p:commandButton>
</p:column>
</p:row>
</f:facet>
This button is at the end of a panelGrid
and above a datatable
.
How to solve this problem of losing component rendering?
Try changing this:
propostaCartaoListBean.lazyModel.rowCount == 0
by a new method in your Viewbean that does this test and places a breakpoint within this method. See what happens.– Leonel Sanches da Silva
@I’ll test and warn you.
– Macario1983
What is the HTML output of
propostaCartaoListBean.lazyModel.rowCount == 0
?– Tiago César Oliveira
@Tiagocésaroliveira looking for now, when I compare returns
true
but records appear ondataTable
.– Macario1983
@Ciganomorrisonmendez is very strange but the
lazyModel.rowCount
returns 0 but shows values in datatable– Macario1983
@Macario1983 It means it is not reliable. I recommend that the test be changed.
– Leonel Sanches da Silva
Any suggestions?
– Macario1983