& lt; p: dialogue & gt; - The dialog box does not close when it should

advertisements

I am using JSF (Mojara) and Primefaces 3.4 in a sample application. I am applying a layout on a screen where on a header (north) there is one Image link (on click a dialog box gets opened).

northheader.xhtml:

<h:body>
        <h:form id="headerForm">    

        <p:panelGrid id="headerFormPanelGridID" style="align:left;border:0px>
                <p:row> 

            <p:column width="70">
    <p:commandLink onclick="dialogWidgetWar.show();"  title="SampleImg">
    <p:graphicImage value="../sampleimg.jpg" />
    </p:commandLink>
            </p:column> 

            </p:row> 

        </p:panelGrid>

    <p:dialog id="idInfo"  modal="true" widgetVar="dialogWidgetWar" header="Sample Layout" border="0" width="400"  height="100" resizable="true" >
        <h:panelGrid id="sampleId" style="cellpadding" border="0" cellpadding="0" cellspacing="0" width="200">

        </h:panelGrid>
    </p:dialog>

        </h:form>
</h:body>

For layout

<html lang="en"
     xmlns="http://www.w3.org/1999/xhtml"
     xmlns:f="http://java.sun.com/jsf/core"
     xmlns:h="http://java.sun.com/jsf/html"
     xmlns:ui="http://java.sun.com/jsf/facelets"
     xmlns:p="http://primefaces.org/ui">
   <h:head>

    </h:head>
    <h:body>    

        <p:layout fullPage="true">
            <p:layoutUnit position="north" size="100" resizable="false" closable="false" collapsible="false">
                     <ui:include src="../northheader.xhtml" /> 

            </p:layoutUnit>

            <p:layoutUnit position="west" size="200" resizable="false" closable="false" collapsible="false">

                    <ui:include src="../left.xhtml" />

             </p:layoutUnit>

            <p:layoutUnit position="center" size="200">

                <ui:insert name="pageContent"></ui:insert>
            </p:layoutUnit>

        </p:layout>

    </h:body>

</html>

Layout is being displayed properly, but when I Click on "SampleImg" link in northheader.xhtml, its getting opened but closing the dialog is not working, even if I add one close button inside the dialog box and onclick="dialogWidgetWar.hide()" is not working. I am not even able to select anything.

Can anybody help me out here, where is the problem?


Add appendToBody="true" attribute inside p:dialog

<p:dialog id="idInfo"  modal="true" appendToBody="true"
widgetVar="dialogWidgetWar" header="Sample Layout" border="0" width="400"  height="100" resizable="true" >