I have implemented a pop up box on my webpage using
<p:dialog header="Value" widgetVar="confirmationCbxTxt" ..>
Now, I want to check whether this pop up box is open when clicking on a Button on my page. The code for my Button is
<p:mandButton value="#{label.close}" ajax="true" id="Close2" onclick="focuspopup();" />
Using the onclick function "onclick="focuspopup();" I want to check whether my pop up box is open on the screen. Could any one suggest the approach . I am thinking of using jquery inside my focuspopup() to test for open popup.
I have implemented a pop up box on my webpage using
<p:dialog header="Value" widgetVar="confirmationCbxTxt" ..>
Now, I want to check whether this pop up box is open when clicking on a Button on my page. The code for my Button is
<p:mandButton value="#{label.close}" ajax="true" id="Close2" onclick="focuspopup();" />
Using the onclick function "onclick="focuspopup();" I want to check whether my pop up box is open on the screen. Could any one suggest the approach . I am thinking of using jquery inside my focuspopup() to test for open popup.
Share edited Jul 16, 2015 at 10:16 Vsevolod Golovanov 4,2353 gold badges33 silver badges68 bronze badges asked Jul 16, 2015 at 10:07 pkn1230pkn1230 1031 gold badge3 silver badges16 bronze badges1 Answer
Reset to default 6Client side API for PrimeFaces.widget.Dialog
contains three methods, according to the PrimeFaces 5.2 User Guide (page 184):
- show() Displays dialog.
- hide() Closes dialog.
- isVisible() Returns visibility as a boolean.
Use the last one to satisfy the requirements. For instance, add this in your focuspopup()
function:
var open = PF('confirmationCbxTxt').isVisible();
Notes: For older PrimeFaces versions (5.1 and below), isVisible() does not exist so you need to replace it by
var open = PF('confirmationCbxTxt').jq.is(':visible');