0

I am facing this issue on minimal two screens/views with many commandButtons that open dialogs in new window. I am using Primefaces 5.3.5 and JSF Mojarra 2.2.8. These actions/actionListeners open a new dialog in popup window. The first commandButton always open new dialog but the others commandButtons do nothing.

<h:form id="dbuserForm">
          <!-- New User Button. This one fires a dialog -->
          <p:commandButton id="newUserGroupBtn" value="#{msg.WEB_BUTTONS_NEW}" style="margin-right: 2px;" actionListener="#{appUserData.toggleNewModal}" icon="fa fa-plus" accesskey="n" update="@form">
              <p:ajax event="dialogReturn" update="@form" />
          </p:commandButton>
    <p:dataTable id="tableDbUser" scrollable="true" width="100%" value="#{tabDbUser.listArray}" var="item" selectionMode="single" rowKey="#{item.idbuserId}">
          <!-- Delete User Button -->
          <p:column>
              <p:commandButton id="deleteAppUserBtn" value="#{msg.WEB_BUTTONS_DELETE}" style="margin-right: 2px;" actionListener="#{appUserData.toggleDeleteModal}" icon="fa fa-remove" accesskey="o" update="@form" disabled="#{appUserData.selectedUserName eq null or appUserData.selectedUserName eq ''}">
                    <p:ajax event="dialogReturn" update="@form" />
                </p:commandButton>
          </p:column>
          <!-- Modify User Button -->
          <p:column>
              <p:commandButton id="modifyAppUserBtn" value="#{msg.WEB_BUTTONS_OPEN}" style="margin-right: 2px;" actionListener="#{appUserData.toggleChangeModal}" icon="fa fa-edit" accesskey="o" update="@form" disabled="#{appUserData.selectedUserName eq null or appUserData.selectedUserName eq ''}">
                    <p:ajax event="dialogReturn" update="@form" />
          </p:column>
    </p:dataTable>
        </h:form>

and my backend bean

@Override
    public void toggleNewModal(ActionEvent event) {
        RequestContext.getCurrentInstance().openDialog("/dialogs/new-dbuser");
    }
@Override
    public void toggleDeleteModal(ActionEvent event) {
        RequestContext.getCurrentInstance().openDialog("/dialogs/del-report-dialog");
}

public void togglePasswordModal() {
        RequestContext.getCurrentInstance().openDialog("/dialogs/modify-dbuser");
    }

NOTE The new user button only fires this dialog(new-dbuser). The others buttons are firing nothing but they are clickable and I see no errors.

I do not know if it is important but my beans are configured as a request scope.

I know that this is very discussed topic in SO but I have not find out any solution that fits to me. Thank you for any help. I am really stuck in because I do not see any error. Please , be constructive.

Skyware
  • 352
  • 1
  • 7
  • 16
  • _"I know that this is very discussed topic in SO but I have not find out any solution that fits to me."_ See [ask]. Post what you found and why it did not work. And post an [mcve] – Kukeltje Aug 16 '16 at 12:36
  • @Kukeltje Thanks, that's it. Please, have a look now and note that the new user button only fires a dialog. – Skyware Aug 16 '16 at 12:53
  • What other topics are about this problem? And what did they not solve for you. That is what I meant. And tried changing the order? What happens then? – Kukeltje Aug 16 '16 at 13:08
  • _"I do not know if it is important but my beans are configured as a request scope."_ Tried changing the scopes? – Kukeltje Aug 16 '16 at 13:09
  • @Kukeltje Thanks, that is it. I changed them back to session scope and they fire now. – Skyware Aug 16 '16 at 13:35
  • Hmmm please do as stated in my first comment. Create an [mcve]. Might be that there is something else wrong that is not visible in the code you posted that causes this behaviour and that is only solved by using a longer scope – Kukeltje Aug 16 '16 at 13:41

1 Answers1

-1

use attribute in Dialog appendTo="(@body)". Using JS open and close dialog like PF('DialogVar').hide() and PF('DialogVar').show(). On any action update dialog. It will work. If it doesn't post your dialog code. Also check browser console. There you might find some error.

  • I do not use dialog on client side. I open dialog in my back-end bean. Please, see my question. – Skyware Aug 16 '16 at 13:01
  • This question is related to the dialog framework, not a normal dialog. You cannot open those like this and the appendTo is not related at all – Kukeltje Aug 16 '16 at 13:04