-
1. Re: Looking for something like "showDelay" for rich:popupPanel?
sivaprasad9394 Nov 16, 2012 9:13 AM (in response to smoking81)You can call the javascript onmouse over function of "Open Popup" text.from there you can open popup.
<script type="text/javascript">
function showPopup(popupid)
{
var start = new Date();
var end = new Date();
var secondsOpen = Math.floor((end - start) / 1000);
if(secondsOpen == 5)
{
#{rich:component(popupId)}.show();
}
}
</script>
Thanks,
Siva
-
2. Re: Looking for something like "showDelay" for rich:popupPanel?
smoking81 Nov 20, 2012 9:34 AM (in response to sivaprasad9394)Hallo Siva! Thank you for your answer!
I just had the opportunity to try out your code but unfortunately I had several problems with it:
1) If I call #{rich:component(popupId)}.show(); within a Javascript function (eg by invoking onmouseover="showPopup('myId');" or "showPopup(myId);"), the popup won't show.
2) The problem with popupPanel is that by default it gets displayed in the middle of the page, so to correctly position it one must use rich:componentControl. This is the reason I didn't use onmouseover="#{rich:component('myId')}.show();'" for outputLabel directy..
Any other suggestion?
Thanks again! Bye
-
3. Re: Looking for something like "showDelay" for rich:popupPanel?
iabughosh Nov 21, 2012 2:02 AM (in response to smoking81)1 of 1 people found this helpfulhello smoking81,
you can do this walkaround :
<a4j:commandButton value="Show" oncomplete="setTimeout('openPopup()', 5000);"/>
<a4j:jsFunction name="openPopup"
oncomplete="#{rich:component('pop')}.show();"/>
regards.
-
4. Re: Looking for something like "showDelay" for rich:popupPanel?
smoking81 Nov 21, 2012 4:28 AM (in response to iabughosh)Hi Ibrahim,
I tried out this:
<h:outputLabel value="Open Popup" id="label" onmouseover="setTimeout(showPP(),10000);" />
<a4j:jsFunction name="showPP" oncomplete="#{rich:component('popup')}.show(event, {top:jQuery(#{rich:element('label')}.parentNode).offset().top + jQuery(#{rich:element('label')}.parentNode).height(),left:jQuery(#{rich:element('label')}.parentNode).offset().left});" />
Result is popup gets immediately (correctly) displayed, that is, the timeout has no effect..
-
5. Re: Looking for something like "showDelay" for rich:popupPanel?
iabughosh Nov 21, 2012 7:08 AM (in response to smoking81)1 of 1 people found this helpfuli think you need to put single quote for setTimeout method parameter :
your code : setTimeout(showPP(), 10000);
correct code : setTimeout('showPP()', 1000);
-
6. Re: Looking for something like "showDelay" for rich:popupPanel?
smoking81 Nov 21, 2012 7:30 AM (in response to iabughosh)Thank you Ibrahim, this will work:
<h:outputLabel value="Open Popup" id="label" onmouseover="setTimeout('showPP()',10000);" />
<a4j:jsFunction name="showPP" oncomplete="#{rich:component('popup')}.show(event, {top:jQuery(#{rich:element('label')}.parentNode).offset().top + jQuery(#{rich:element('label')}.parentNode).height(),left:jQuery(#{rich:element('label')}.parentNode).offset().left});" />
Unfortunately, this is still not the desired result, since I want to open the dialog only if the user stays X seconds with the mouse on the label (and setTimeout will open it in any case, just with a delay of X seconds)..
-
7. Re: Looking for something like "showDelay" for rich:popupPanel?
iabughosh Nov 21, 2012 7:48 AM (in response to smoking81)to achieve this you need some extra code :
<a4j:commandButton value="Show" onmouseover="setTimeout('openPopup()', 5000);setFlag(true);" onmouseout="setFlag(false);"/>
<a4j:jsFunction name="setFlag">
<a4j:param name="showDialog" assignTo="#{yourBean.showDialog}"/>
</a4j:jsFunction>
<a4j:jsFunction name="openPopup"
oncomplete="if(#{yourBean.showDialog}){#{rich:component('pop')}.show();}"/>
where yourBean is a bean with Session or View scope and showDialog is a boolean property.