Reputation: 91
I wanna know if it is possible to call multiple instances of a dialog created only once.
Ex:
I have this code that create the dialog:
<p:dialog id="dlgFormUsu" header="Dialog User" maximizable="true"
minimizable="true" hideEffect="fade" widgetVar="dlgFormUsu"
resizable="false" closable="true" draggable="true">
When I call dlgFormUsu.show()
it opens normally, but if I try to open it again nothing shows.
Anyway to open this same dialog twice?
Upvotes: 3
Views: 421
Reputation: 22867
No, dialog has only one instance, which is either shown or hidden. Calling show() and hide() you respectively shows or hides the dialog.
If you need multiple instances of dialog, declare dialog within ui:composition
and instantiate it many times using ui:include
:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:p="http://primefaces.org/ui">
<ui:dialog id="myDialog#{id}" widgetVar="myDialog_widget#{id}" .... />
</ui:composition>
<ui:include src="mydialog.xhtml">
<ui:param name="id" value="first" />
</ui:include>
<ui:include src="mydialog.xhtml">
<ui:param name="id" value="second" />
</ui:include>
Upvotes: 2