I agree with you.
I will only display a warning message that advises the user that it risk to lost his work if he close the Dialog panel.
To do this, I need a specific event that currently don't exist or happens too late ! (I think)
I have created an issue (Change Request) on Primefaces GITHUB.
How to intercept <p:dialog> CLOSE event and STOP it
@kukeltje that has answered to same question on StackOverflow
You propose that I analyze the code ... well ... I have now make that.
But I have a little question:
If a make an "correction", where must I do it ?
1. directly in PrimeFaces code downloaded from GITHUB ?
or
2. in overriding hide() function of PrimeFaces.widget.Dialog() object ?
I don't know if second solution is possible, but I'm interesting to search in this direction.
If you think that second solution is possible, how can I obtain PrimeFaces.widget.Dialog() object from onLoadDialog() method() that is called just after dialog has been loaded ?
Thank for any help
You propose that I analyze the code ... well ... I have now make that.
But I have a little question:
If a make an "correction", where must I do it ?
1. directly in PrimeFaces code downloaded from GITHUB ?
or
2. in overriding hide() function of PrimeFaces.widget.Dialog() object ?
I don't know if second solution is possible, but I'm interesting to search in this direction.
If you think that second solution is possible, how can I obtain PrimeFaces.widget.Dialog() object from onLoadDialog() method() that is called just after dialog has been loaded ?
Thank for any help
PrimeFaces 6.2.4
Mojarra 2.2.13
Glassfish 4.1
Mojarra 2.2.13
Glassfish 4.1
ok, I'm approaching the solution ...
Currently, I think that I have found the JQueryWidget using following code :
var wgDialog = jQuery(".ui-dialog").children(":first-child");
The problem is that I use a DialogFramework and not a simple <p:dialog>.
The html code that I can see on browser is
My question now is : How can I find the PrimeFaces widgetvar to override it ?
Is JQuery widget equivalent to PrimeFaces widget ? (I think NO, but I'm not sure)
Another question will be:
When I have found a PrimeFaces widget contained in DialogFramework, can I use .parent() or jq.parent() to find PrimeFaces.widget.Dialog not JQuery widget ?
Currently, I think that I have found the JQueryWidget using following code :
var wgDialog = jQuery(".ui-dialog").children(":first-child");
The problem is that I use a DialogFramework and not a simple <p:dialog>.
The html code that I can see on browser is
Code: Select all
<div
id="FormSession:j_idt271:0:CtcActionTable:0:j_idt280_dlg"
class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-shadow ui-hidden-container ui-draggable ui-resizable ui-overlay-visible"
data-pfdlgcid="ec2f04a9-5381-41f7-96a1-caab0f56b7ff"
data-widgetvar="FormSession_j_idt271_0_CtcActionTable_0_j_idt280_dlgwidget"
role="dialog"
aria-labelledby="FormSession:j_idt271:0:CtcActionTable:0:j_idt280_dlg_title"
aria-hidden="false"
aria-live="polite"
style="width: 80%; height: auto; left: 167.5px; top: 32px; visibility: visible; z-index: 1016; display: block;"
>
<div class="ui-dialog-titlebar ui-widget-header ui-helper-clearfix ui-corner-top ui-draggable-handle">
<span class="ui-dialog-title">CTC input: 56826</span>
<a class="ui-dialog-titlebar-icon ui-dialog-titlebar-close ui-corner-all" href="#" role="button">
<span class="ui-icon ui-icon-closethick"></span>
</a>
</div>
<div
class="ui-dialog-content ui-widget-content ui-df-content"
style="height: 90vh;"
>
<iframe ...
Is JQuery widget equivalent to PrimeFaces widget ? (I think NO, but I'm not sure)
Another question will be:
When I have found a PrimeFaces widget contained in DialogFramework, can I use .parent() or jq.parent() to find PrimeFaces.widget.Dialog not JQuery widget ?
PrimeFaces 6.2.4
Mojarra 2.2.13
Glassfish 4.1
Mojarra 2.2.13
Glassfish 4.1
I have found how to intercept CLOSE event ...
I have only one problem ... it is
How can I call PrimeFaces.widget.Dialog.hide() to close the windows ?
I have tried a lot of instruction that are all in comment // but none of them works (except if I have badly tested ... it is also possible)
Code: Select all
var jqDialog = jQuery(".ui-dialog.ui-overlay-visible",window.parent.document).children(":first-child");
var sWidgetName = jqDialog.attr('data-widgetvar');
var wgDialog = window.parent.PF(sWidgetName);
wgDialog.hide = function()
{
alert("OnHide()");
console.log('hide() in dialog');
//PrimeFaces.widget.Dialog.hide();
//PrimeFaces.widget.Dialog.protopype.hide();
//this.hide();
// __super__.hide();
//this.jq.hide();
}
How can I call PrimeFaces.widget.Dialog.hide() to close the windows ?
I have tried a lot of instruction that are all in comment // but none of them works (except if I have badly tested ... it is also possible)
PrimeFaces 6.2.4
Mojarra 2.2.13
Glassfish 4.1
Mojarra 2.2.13
Glassfish 4.1
@Kukeltje: I have found a solution to my problem.
The code I have posted previously is not correct.
This code provides from a JQuery.each() instruction that I have simplified and this doesn't work.
I have posted a Question on StackOverflow about that and I will come back to this forum when I have the simplified response.
The code I have posted previously is not correct.
This code provides from a JQuery.each() instruction that I have simplified and this doesn't work.
I have posted a Question on StackOverflow about that and I will come back to this forum when I have the simplified response.
PrimeFaces 6.2.4
Mojarra 2.2.13
Glassfish 4.1
Mojarra 2.2.13
Glassfish 4.1
Older topic but still an issue. If you need to intercept *before* the close action, the solution is to exchange the X button's click() function to click onto the dialog's desired no/cancel button.
See this issue: https://github.com/primefaces/primefaces/issues/1001
See this issue: https://github.com/primefaces/primefaces/issues/1001
PrimeFaces 13, Mojarra 4.0, WildFly 31, Jakarta 10 + PrimeReact
-
- Information
-
Who is online
Users browsing this forum: No registered users and 46 guests