Non-Global Confirm Dialog show function not working after upgrade

UI Components for JSF
Post Reply
aveyD6
Posts: 3
Joined: 09 Mar 2018, 21:55

09 Mar 2018, 22:48

Hi,

I'm upgrading from Primefaces 5.2 -> 6.2 and I'm having issues with the confirm dialog box not showing up. When i click the command button I expect the confirm dialog box to show up but instead i see the following error in the console:

Code: Select all

Uncaught TypeError: Cannot read property 'style' of undefined
    at c.show (VM7398 components.js.xhtml:13)
...
Looking at the components.js from Primefaces 6.2 version i see the show function of PrimeFaces.widget.Dialog:

Code: Select all

    show: function() {
        if (this.isVisible()) {
            return
        }
        if (!this.loaded && this.cfg.dynamic) {
            this.loadContents()
        } else {
            if (this.cfg.fitViewport) {
                this.fitViewport()
            }
            if (this.positionInitialized === false) {
                this.jqEl.style.visibility = "hidden";
                this.jqEl.style.display = "block";
                this.initPosition();
                this.jqEl.style.display = "none";
                this.jqEl.style.visibility = "visible"
            }
            this._show()
        }
    },
The issue lies on this line:

this.jqEl.style.visibility = "hidden";

This is because "this.jqEl" is undefined. As part of the init function of PrimeFaces.widget.Dialog "this.jqEl" is set by:

Code: Select all

this.jqEl = this.jq[0];
But this.jq[0] is undefined as well. Primefaces 5.2 had primefaces.js and the show function looked like this:

Code: Select all

    show: function() {
        if (this.isVisible()) {
            return
        }
        if (!this.loaded && this.cfg.dynamic) {
            this.loadContents()
        } else {
            if (!this.positionInitialized) {
                this.initPosition()
            }
            this._show()
        }
    },
So if we require "this.jqEl" to be set properly what could I be missing? Here is my command button and dialog box for reference:

Code: Select all

<h:form>
...
<p:commandButton onclick="PF('submitDialog').show()" value="Submit" />

<p:confirmDialog widgetVar="submitDialog" header="Confirmation"
	message="Are you sure you want to submit this record?"
	showEffect="fade" hideEffect="fade" severity="alert">
    <p:commandButton value="Yes" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" ajax="false"
    	action="#{controller.submit}" oncomplete="PF('submitDialog').hide()" />
    <p:commandButton value="No" styleClass="ui-confirmdialog-no" icon="ui-icon-close"
    	oncomplete="PF('submitDialog').hide()" />
</p:confirmDialog>
...
</h:form>
I am using JSF 2.0 and Weblogic 11g.

Thanks

David

Drake
Posts: 44
Joined: 25 Jan 2011, 10:59

13 Mar 2018, 12:07

Same problem migrating from 6.1 to 6.2
WildFly 10.1.0 Final, Mojarra 2.2.15 PrimeFaces 6.2

kukeltje
Expert Member
Posts: 8990
Joined: 17 Jun 2010, 13:34
Location: Netherlands

13 Mar 2018, 12:26

in many of the cases this is related to duplicate jquery or even duplicate PrimeFaces version in the deployed app
Ronald van Kuijk
______________________________
PrimeFaces 6.1, PrimeFaces plus 0.0.2 | JbossWildfly 10.1| Mojarra 2.2.13
Fedora 61, Firefox 'most recent'
Read the forum posting rules
Beginners: https://jsf.zeef.com/bauke.scholtz

aveyD6
Posts: 3
Joined: 09 Mar 2018, 21:55

13 Mar 2018, 16:30

kukeltje wrote:
13 Mar 2018, 12:26
in many of the cases this is related to duplicate jquery or even duplicate PrimeFaces version in the deployed app
In the sources tab in Chrome developer tools i see the javax.faces.resources folder with a jquery folder and it has jquery-plugins.js and jquery.js (I'm assuming there is no overlap with these 2). At the root of the javax.faces.resouces folder there is components.js and core.js (from primefaces) and jsf.js.

Any other thoughts?
Thanks

Drake
Posts: 44
Joined: 25 Jan 2011, 10:59

14 Mar 2018, 15:32

In our EAR there is only a primefaces.jar and in we have no explicit import of jQuery...
Since we are hurry, we used <p:dialog> styled look alike <p:confirmDialog> as workaround
WildFly 10.1.0 Final, Mojarra 2.2.15 PrimeFaces 6.2

tandraschko
PrimeFaces Core Developer
Posts: 3423
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

14 Mar 2018, 15:38

I would like to fix the bug but impossible without a small as possible replicator.
Always Bet On Prime (+ Extensions)!

Thomas Andraschko
PrimeFaces Developer | PrimeFaces Extensions Founder
Apache OpenWebBeans PMC | Apache DeltaSpike PMC | Apache MyFaces PMC

Personal Blog: http://tandraschko.blogspot.de/

aveyD6
Posts: 3
Joined: 09 Mar 2018, 21:55

15 Mar 2018, 15:56

tandraschko wrote:
14 Mar 2018, 15:38
I would like to fix the bug but impossible without a small as possible replicator.
If the primefaces showcase had a sample with a non-global confirmDialog you could probably easily reproduce this. Global confirm dialog's and regular dialog's work fine, just not non-global confirmDialogs. I have also converted my confirmDialog's into regular dialog's until this bug is fixed.

tandraschko
PrimeFaces Core Developer
Posts: 3423
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

15 Mar 2018, 16:06

Feel free to create a sample and provide a PR, so we can easily test in the future.
Always Bet On Prime (+ Extensions)!

Thomas Andraschko
PrimeFaces Developer | PrimeFaces Extensions Founder
Apache OpenWebBeans PMC | Apache DeltaSpike PMC | Apache MyFaces PMC

Personal Blog: http://tandraschko.blogspot.de/

Post Reply
  • Information
  • Who is online

    Users browsing this forum: Bing [Bot] and 12 guests