Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open multiple instaces of dialog

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?

like image 852
gmlyranetwork Avatar asked Dec 11 '25 05:12

gmlyranetwork


1 Answers

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>
like image 131
Danubian Sailor Avatar answered Dec 12 '25 17:12

Danubian Sailor