Reputation: 189
Don't know how to check if modal Panel has been opened or not.
<a4j:commandButton id="backButtonId" value="#{msg.back}"
action="#{someCommonAction}"
oncomplete="if ( MyModalPanel Has Been Opened) #{rich:component('MyModalPanel').hide() else Nothing;"
/>
How can i do it with javascript but not using managed beans?
thank you for your answers in advance.
Upvotes: 2
Views: 3036
Reputation: 21
The following should do the trick for you:
#{rich:component('MyModalPanel')}.shown
Upvotes: 2
Reputation: 1108692
You could use jQuery.is()
for this wherein you check if the element is :visible
.
oncomplete="if (#{rich:component('MyModalPanel')}.is(':visible')) #{rich:component('MyModalPanel')}.hide();"
But this is useless. It doesn't harm to call hide()
on an already hidden modal panel.
oncomplete="#{rich:component('MyModalPanel')}.hide();"
Upvotes: 4