Is there a way to change dynamically the background of the PrimeFaces growl component? I want to be able to show a red background when it's an error and a green background when is a success.
Thanks in advance.
<style>
div[id="forma:growl-error_container"] > div {
background-color: red !important;
}
div[id="forma:growl-success_container"] > div{
background-color: green !important;
}
</style>
<h:form id="forma">
<p:growl id="growl-error" showDetail="true" sticky="true" rendered="#{facesContext.maximumSeverity.ordinal eq 2}"/>
<p:growl id="growl-success" showDetail="true" sticky="true" rendered="#{facesContext.maximumSeverity.ordinal eq 0}"/>
<p:panel header="Growl">
<h:panelGrid columns="2" cellpadding="5">
<p:outputLabel for="msg" value="Message:"/>
<p:inputText id="msg" value="#{growlView.message}" required="true" />
</h:panelGrid>
<p:commandButton value="Save" actionListener="#{growlView.saveMessage}" update="@form" />
</p:panel>
</h:form>
This is group of code which is used to demonstrated.