-1

This is my dialog.

<p:dialog closeOnEscape="true" resizable="false"
            header="Confirmation" widgetVar="groupconfirmation">
            <center>
                Do you want to remove this Pin Priority group?<br /> <br />
                <p:commandButton value="Yes" oncomplete="groupconfirmation.hide()"
                    actionListener="#{pinProrityHandler.deletePinPriorityGroup}"
                    update="pinprioritygroup" />

                <p:commandButton value="No"
                    actionListener="#{platformGroupHandler.onGroupReset}"
                    oncomplete="groupconfirmation.hide()" update="pinprioritygroup" />
            </center>
</p:dialog>

And this is my java code:

  try {                 
        RequestContext.getCurrentInstance().execute("groupconfirmation.show()");
    } catch (Exception e) {
        logger.error("Error {}", e);
    }

I don't know why my code is not working.

I am new to primeface.

James Z
  • 12,209
  • 10
  • 24
  • 44
Surojit Jana
  • 101
  • 2
  • 16
  • 2
    Define 'not working' and what did you debug? With a recent PF version, I'm sure there are client-side errors – Kukeltje Dec 07 '17 at 19:10
  • Possible duplicate of [Get primefaces widgetVar in javascript and update it](https://stackoverflow.com/questions/28609536/get-primefaces-widgetvar-in-javascript-and-update-it) – Kukeltje Dec 09 '17 at 09:11

1 Answers1

2

For Primefaces <= 3.x

RequestContext context = RequestContext.getCurrentInstance();
context.execute("groupconfirmation.show();");

For Primefaces >= 4.x

RequestContext context = RequestContext.getCurrentInstance();
context.execute("PF('groupconfirmation').show();")
pwain
  • 279
  • 2
  • 7
  • For many of these basic questions there are already existing duplicates in stackoverflow. Many of them with more context detail and mote. It is good practice to find them and mark the questions such. Keeps SO 'clean' – Kukeltje Dec 09 '17 at 09:13