I'm implementing some dialogs that need a common poll to get fresh values from the server. I'm trying use p:poll, but unfortunately I cant stop it. I start the poll when a user clicks on a button in one dialog, and try stop that when a user clicks a button in a child dialog. This is the code I`m using to start and stop the poll:
firstDialog:
<p:poll autoStart="false" widgetVar="pollQtdDisponivelCarregamento" immediate="true"
update="labelQuantidadeDisponivelCarregamento labelQuantidadeDisponivelItem"
listener="#{atualizadorQuantidadeDisponivelProduto.atualizarQuantidadeDisponivel(modeloPopupCarregarProduto.produtoSelecionado)}" />
<p:commandButton action="#{controladorPopupCarregarProduto.abrir}"
value="#{vendaMsg['popup.pre_venda.botao.adicionar_produto']}"
title="#{vendaMsg['popup.pre_venda.botao.adicionar_produto.descricao']}"
update="@form" onclick="pollQtdDisponivelCarregamento.start()" />
childDialog:
<p:commandButton value="OK" style="float:right" immediate="true"
action="#{controladorPopup.fechar}" update="@form"
onsuccess="pollQtdDisponivelCarregamento.stop();" />
One thing I can't understand is: when I break javascript execution using Firebug debug, the poll stops correctly, but when I don't do this, it just don't stop. Someone knows how can I solve this??