How to update a number of messages on the topbar menu

Post Reply
nuttipolc
Posts: 7
Joined: 18 Oct 2016, 04:53

26 Aug 2019, 06:46

How to update a number of messages on the topbar menu?

topbar.xhtml

Code: Select all

<a href="#">
 <i class="topbar-icon fa fa-fw fa-inbox"></i>
 <span class="topbar-item-name">Messages</span>
 <span class="topbar-badge">#{messageBean.messageCount}</span>
</a>

In case I've click p:commandButton with ajax mode because topbar.xhtml doesn't support to insert h:form.
(I've tried to insert h:form after <ul class="topbar-menu fadeInDown"> but the layout is distorted.)

forms.xhtml

Code: Select all

<p:commandButton type="button" icon="fa fa-star" style="width:30px" 
 actionListener="#{commonBean.saveAction}" update="?" />
Do you have another solution to solve this problem?

mert.sincan
Posts: 4638
Joined: 29 Jun 2013, 12:38

02 Sep 2019, 14:39

Please try;

Code: Select all

//topbar.xhtml
...
<h:form id="myform">
        <ul class="topbar-menu fadeInDown">
            ...
            <a href="#">
                    <i class="topbar-icon fa fa-fw fa-inbox"></i>
                    <span class="topbar-item-name">Messages</span>
                  <h:panelGroup id="test" styleClass="topbar-badge">#{messageBean.messageCount}</h:panelGroup>
             </a>
          ...     
        </ul>
</h:form>

....

<p:commandButton update="myform:test" .../>
Best Regards,

Post Reply

Return to “Babylon - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest