Skip to content Skip to sidebar Skip to footer

Show Growl Using Javascript

I want to display a growl in client-side using Javascript. I mean this UI-component: I found this thread , However , I can't find an object called :topBar Known also that using:

Solution 1:

The component you are referring to is Growl, in the client-side it's represented by PrimeFaces.widget.Growl which has renderMessage function to render a single growl message.

Assuming you have already defined a growl component in your page with a widgetVar name:

<p:growl widgetVar="growlWV" />

Now in javascript

PF('growlWV').renderMessage({"summary":"summary goes here",
                             "detail":"detail goes here",
                             "severity":"warn"})

The severity are obviously three types :

  • info

    info growl

  • warn

    warn growl

  • error

    error growl

Solution 2:

This worked for me with primefaces:

<script type="text/javascript">
    function validateSearch(){
               PF('growlWV').init({'msgs':'"summary":"Select a State Medical Unit or Demographic Capture Date", "severity":"info" ',
                   "life":"9000"})
           }

    }

You can see the methods here: https://searchcode.com/codesearch/view/2686099/

Post a Comment for "Show Growl Using Javascript"