primefacesmessagegrowl

Show messages based on Severity in two p:growl


I'm using PrimeFaces p:growl.

<p:growl id="msgsInfo"
         rendered="true"
         showDetail="true" />
<p:growl id="msgsError"
         globalOnly="true"
         showDetail="true"
         sticky="true" />

I need to show in the first growl only Info messages while in the second I need to show Error messages. Using globalOnly when I add error message this is show 2 times.

Any idea?


Solution

  • It would in theory be possible if it supported infoClass, errorClass, etc attributes like as h:messages. You could then just specify a CSS class which does a display: none.

    But the p:growl doesn't support those attributes. On the severity level all you can do is changing the icon by infoIcon, errorIcon, etc. So you're pretty lost here.

    It might be worth a feature request.

    Note that the globalOnly="true" only displays messages which have a null client ID, regardless of their severity.