I’m rewriting static menu to dynamic, since our customer wants to dynamically change the menu on the fly. Before that I had standard <p:menu> <p:menuItem> </p:menu> structure in my xhtml.
But now I have changed it to:
<p:menu model="#{pageTemplateView.menuModel}"/>
And I’m creating model in my backing bean like this:
DefaultMenuItem menuItem = new DefaultMenuItem();
menuItem.setIcon(item.getIcon());
menuItem.setTarget(item.getLink());
menuItem.setValue(item.getName());
But the problem is I don’t know how to add <pe:badge>
component inside menu item from bean.
Before that I included badges to menus the following way:
<p:menuitem id="tasks_icon_menuitem_id" icon="fa fa-tasks" url="#">
<pe:badge content="#{badgeCountBean.badgeCount()}"/>
</p:menuitem>
So how do I add <pe:badge>
to dynamically created menu in bean?
I'm using PrimeFaces 8
for
attribute. Note that the badge is deprecated in PFE 10. – Jasper de Vriesfor
but it doesn't seem to work. – Kiki