Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I display a modal dialog after the preRenderView event has been executed in JSF?

I have the following in my jsf xhtml page:

<h:body>
 <ui:define name="metadata">
 <f:metadata>
  <f:viewParam name="dummy"/>
  <f:event type="preRenderView" listener="#{bean.getDataMethod}"/>
  <f:attribute name="param1" value="${param.param1}"></f:attribute>
  <f:attribute name="param2" value="${param.param2}"></f:attribute>
 </f:metadata>
 </ui:define>

 <p:dialog header="Modify" widgetVar="modDialog" height="650" width="1500" resizable="false" showEffect="explode" modal="true" draggable="false" hideEffect="explode">
  <p:panel id="modifyPanel">
   <c:if test="#{null != bean.databean}">
    <ui:include src="modifyData.xhtml"></ui:include>
   </c:if>
  </p:panel>
 </p:dialog>
</h:body>

I need to display the modal dialog box after the preRenderView has been executed. And, I also need to make sure that all data will be displayed in the modal dialog box.

like image 782
Angel Avatar asked Dec 15 '22 09:12

Angel


1 Answers

Just set its visible attribute to true.

<p:dialog ... visible="true">

If you intend to display it on a condition which is determined during preRenderView, then just bind it to a boolean bean property the usual way.

<p:dialog ... visible="#{bean.dialogVisible}">

See also:

  • Difference between rendered and visible attributes of <p:dialog>
like image 142
BalusC Avatar answered May 24 '23 14:05

BalusC