I have a commandLink that is loaded with information inside a dataTable, the logic is that when the variable showPopup is true it shows me a popup, otherwise it does not show it. The variable changes depending on certain conditions and it is managed in my bean in a method that is called popup. The problem that I have is that when this commandLink is clicked it is not taking the value of the variable showPopup that the method assigns it, but if it is changing the value of the variable for what if I want that it works I must give it another click and there it takes the wished value. In summary I believe that the commandLink does not update the value of the variable showPopup when this changes in the method.
The bean is @ManagedBean @RequestScoped
<!-- more code -->
<t:fieldset styleClass="fieldsetEstilo"
legend="#{mensaje.label_roles}">
<h:panelGroup id="roles">
<p:outputPanel id="outputRoles">
<p:message for="tRoles" />
<p:dataTable value="#{usuario.listaRoles}" var="objRol"
id="tRoles" reflow="true"
emptyMessage="#{mensaje.message_no_existen_registros}">
<f:facet name="header">#{mensaje.label_listado_de} #{mensaje.rol_label_s}</f:facet>
<p:column styleClass="W16P">
<f:facet name="header" />
<!-- HERE IS MY COMMAND LINK -->
<p:commandLink id="asignarLink" styleClass="estiloIcono"
actionListener="#{usuarioAction.setRolPJ(objRol)}"
action="#{usuarioAction.limpiarFechasRoles()}"
oncomplete="if ('#{usuarioAction.mostrarPopupAsignarRol}' == 'true') { PF('popUpAsignarRol').show(); };"
update=":usuarioForm:outputRoles, :usuarioForm:tablaRolesUsuario, :asignarRol, asignarLink"
process="@this">
<i class="fa fa-plus-circle" />
<p:tooltip for="asignarLink" position="top">
<p:outputLabel value="#{mensaje.label_asignar}" />
</p:tooltip>
</p:commandLink>
<!-- more code -->
I have tried to change some values of the action and update properties of the commandLink but I have not achieved any change.
Resolved: I only change the visible property in the p:dialog, my problem was in the property oncomplete of the p:commandLink