Modal Dialog Problem in RC2

UI Components for JSF
Post Reply
WolinDesign
Posts: 36
Joined: 21 Oct 2010, 22:47

13 Dec 2010, 19:09

I'm using a modal dialog to show a progress bar. The whole screen goes inactive, including the dialog box.

Code: Select all

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    
    <body>
        
        <ui:composition template="./CL_Template.xhtml">                  
            <ui:define name="content">
                <h:form>
                    <table>
                        <tr>
                            <td>
                                <h:outputText value="Would you like to print the report?" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <h:commandButton id="cmdBtn" value="Run Report" action="#{reportBean.runReport}"
                                                 onclick="dlg.show();pbAjax.start();" />
                            </td>
                            <td>
                                <p:dialog header="Creating Report" modal="true" widgetVar="dlg">
                                    <p:progressBar widgetVar="pbAjax" style="height: 15px"
                                                    ajax="true" value="#{progressBarBean.progress}"/>
                                </p:dialog>
                            </td>
                        </tr>
                    </table>
                </h:form>                
            </ui:define>
        </ui:composition>        
    </body>
</html>
The same code works as it should in 2.2-SNAPSHOT. The template is also using <p:layout>, not sure if that is contributing to the issue.
Sean - WDG
PF 2.2 JSF 2.0 NetBeans 6.9.1 Glassfish 3.0.1 Mojarra 2.0.3

WolinDesign
Posts: 36
Joined: 21 Oct 2010, 22:47

13 Dec 2010, 21:26

Update:

I tried replacing the 2.2RC2 .jar with the 2.2-SNAPSHOT .jar, only to run into the same problem with the modal dialog. A little further research showed that there was another problem with the dialog when being used inside a <p:layout> tag, like I'm trying to do. I can't move the dialog outside the <h:form> tags as suggested in another thread because I'm using the dialog to display a progress bar, which needs to be inside a form. Also, the appendToBody attribute isn't fixing this problem.
Sean - WDG
PF 2.2 JSF 2.0 NetBeans 6.9.1 Glassfish 3.0.1 Mojarra 2.0.3

User avatar
tefron
Posts: 94
Joined: 15 Sep 2010, 23:54
Location: Canada
Contact:

14 Dec 2010, 22:35

move the dialog outside the layout and the form and create another form inside the dialog
Here is my code:

Code: Select all

            <p:confirmDialog message="Are you sure you want to delete the selected items?" severity="alert" modal="true" widgetVar="deleteConfirm" header="Confirm delete">
                <h:form>
                    <p:commandButton value="Yes Sure" oncomplete="deleteConfirm.hide();" update=":form1:messages" actionListener="#{treeBean.deleteSelectedNodes}"/>
                    <p:commandButton value="No Cancel" onclick="deleteConfirm.hide();"/>
                </h:form>
            </p:confirmDialog>
            <p:layout fullPage="true">
                <p:layoutUnit position="center" >
                    <h:form id="form1">
......
Cheers,
Tamir
PrimeFaces: primefaces-8.0
Mojara2.3
Netbeans8.2
wildfly-17.0.1.Final

WolinDesign
Posts: 36
Joined: 21 Oct 2010, 22:47

15 Dec 2010, 01:00

Thanks Tamir, that worked with a slight modification.

I'm using <p:layout> in my main template. In order to use the <p:dialog> I changed the tags on my report page from <ui:composition> to <ui:decorate>, placed the dialog outside the <ui:decorate> tags as you suggested and the modal dialog and ajax progress bar work as expected. Thanks!
Sean - WDG
PF 2.2 JSF 2.0 NetBeans 6.9.1 Glassfish 3.0.1 Mojarra 2.0.3

User avatar
tefron
Posts: 94
Joined: 15 Sep 2010, 23:54
Location: Canada
Contact:

15 Dec 2010, 18:08

Awesome! thanks for the tip with the decorate.
Tamir
PrimeFaces: primefaces-8.0
Mojara2.3
Netbeans8.2
wildfly-17.0.1.Final

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 46 guests