最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to check if p:dialog is open? - Stack Overflow

programmeradmin0浏览0评论

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 badges
Add a ment  | 

1 Answer 1

Reset to default 6

Client 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'); 
发布评论

评论列表(0)

  1. 暂无评论