Reputation: 336
I am trying to open a dialog box in JSF using p:commandLink
<p:commandLink id="linkId" update="@this someDialogId" value="open dialog" action="#{someBean.someAction(id)}"/>
<p:dialog closable="true" id="someDialogId" closeOnEscape="true" maximizable="true" minimizable="true" fitViewport="true" modal="true" header="Task Details" rendered="#{someBean.displayDiag}" visible="#{someBean.displayDiag}" >
// Something displayed
</p:dialog>
But nothing happens when I click over the p:commandLink ?
This p:commandLink and p:dialog are located in different div's inside the same form.
Upvotes: 0
Views: 664
Reputation: 1560
Have a look at the PrimeFaces showcase: https://www.primefaces.org/showcase/ui/overlay/dialog/basic.xhtml
You update the dialog but you do not open it.
First of all your dialog needs a widgetVar property. Let’s say it's "myDialog".
Then in your commandLink you add a java script handler for oncomplete. There you open the dialog.
Like <p:commandLink ... oncomplete="PF('myDialog').show()" ... />
Upvotes: 1