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)
...
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()
}
},
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];
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()
}
},
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>
Thanks
David