Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 299
Roberto de Santis Avatar asked Jan 15 '11 17:01

Roberto de Santis


2 Answers

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.

like image 96
BalusC Avatar answered Sep 22 '22 06:09

BalusC


Please see my answer

PrimeFaces growl change color dynamically (Multiple messages)

You can also find the source code of the project which produces the page below:

enter image description here

like image 43
ngc4151 Avatar answered Sep 24 '22 06:09

ngc4151