I'm having an odd problem with Notification bar in Primefaces. Actually, Notification bar itself displays on page load without problems, and buttons for open/hide work fine.
Problem is in JavaScript call for hiding Notification bar - it doesnt work. It doesn't work even if I exclude setTimeout and call hide function directly. Situation is same even with button for displaying Bar - button works, but it is not working from JavaScript.
And I checked, if I put alert in JavaScript it displays without problems, so functions are working.
Any ideas?
Thanks!
<h:form>
...
<p:notificationBar position="top" effect="slide"
styleClass="top" widgetVar="bar" autoDisplay="true">
<p:commandButton id="barOff" onclick="PF('bar').hide()"
type="button" icon="ui-icon-arrow-1-n"/>
<h:outputText value="Some text" style="font-size:36px;" />
</p:notificationBar>
<p:commandButton id="barOn" value="Show" onclick="PF('bar').show()"
type="button" icon="ui-icon-arrow-1-s"/>
</h:form>
<script type="text/javascript">
function load() {
setTimeout(close(), 3000);
}
function close() {
document.getElementById('barOff').click();
}
document.getElementsByTagName('body')[0].onload = load();
</script>