The problem was that he could reference the ID of the hidden panel because it didn't exist yet. simply refresh a parent of the panel instead.
for example
<xp:panel id="panel1">
<xp:panel id="panel2" rendered="#{javascript:viewScope.example}"> // example is false
......
</xp:panel>
</xp:panel>
in this situation you can't change viewScope.example and refresh panel2 because it doesn't exist, modify example and refresh panel1