How to update a number of messages on the topbar menu

Forum rules
Please note that response time for technical support is within 3-5 business days.
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: 5281
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 9 guests