I reviewed my code lot of times and didnt find questions about it.
I have a problem with p:commandButton rendered property. The p:commandButton is allways displayed even
You can only ajax-update a component which is always rendered (i.e. when it does not have a rendered
attribute). JSF ajax engine does not support addition/removal of a HTML element. It only supports the change of a HTML element.
So, wrap it in a component which is always rendered and ajax-update it instead.
<p:selectOneMenu id="cmbPais" value="#{pessoaController.selected.endereco.pais}">
<f:selectItems value="#{paisController.itemsSelectOne}"/>
<p:ajax event="change" update="cmbEstado,btnBuscaPeloEndereco,test"/>
</p:selectOneMenu>
<h:panelGroup id="btnBuscaPeloEndereco">
<p:commandButton icon="ui-icon-correios" type="button" onclick="dlgCEP.show();" rendered="#{pessoaController.selected.endereco.ok}"/>
</h:panelGroup>
If you don't want modify your code, you can use css instead rendered ej:
<x:element style="#{condition ? 'visibility: hidden':' visibility: visible'}" />
EDIT: this can be undo by some user so if you element need to be secure don't use. however if you want to hide/show only with visual purpose you can use it.