Menu highlighting error.

Forum rules
Please note that response time for technical support is within 3-5 business days.
Post Reply
Proyecto SIAM
Posts: 5
Joined: 24 Oct 2017, 18:37

04 Jan 2018, 17:59

Hi.
I got a dynamic menu, the model is created the first time the user enter to the index page based on user permissions. Sometimes when I click on some item in the menu, the highlighted element is incorrect.

The code for the menu is as follows.

Code: Select all

<ui:composition 
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui"
    xmlns:pa="http://primefaces.org/barcelona">
    
    <div class="layout-sidebar layout-sidebar-dark">

        <pa:tabMenu>
            <pa:tab icon="fa fa-anchor" title="Pantallas">
                <h:form id="menu">
                    <pa:menu widgetVar="me" model="#{menu.model}"/>
                </h:form>
            </pa:tab>
        </pa:tabMenu>        
    </div>
    
</ui:composition>
Part of the result HTML code is:

Code: Select all

<ul role="menu" style="display: block;">
  <li id="menu:j_idt73_0_0" role="menuitem">
    <a class="ripplelink" href="/SISTEMA/nuevoUsuario.xhtml" >..</a>
  </li>
  <li id="menu:j_idt73_0_1" role="menuitem">
    <a class="ripplelink" href="/SISTEMA/usuariosRegistrados.xhtml" >
      <i class="fa fa-users">..</i>
      <span>Control de usuarios</span>
    </a>
  </li>
</ul>
How can I solve this issues?
I'm using JSF 2.2, Wildfly Server 10.1.0, Primefaces 6.0 and Barcelona 1.0.2

Proyecto SIAM
Posts: 5
Joined: 24 Oct 2017, 18:37

15 Jan 2018, 21:47

I found the solution.
Some pages had the code:

Code: Select all

<f:metadata>
        <f:viewAction action="#{someBean.someMethod()}"/>
    </f:metadata>
The solution is to change the viewAction and replace it with event, like this:

Code: Select all

<f:metadata>
        <f:event type="preRenderView" listener="#{someBean.someMethod()}"/>
    </f:metadata>
After doing this change, the menu works correctly.

kubrasulukan
Posts: 87
Joined: 10 Jan 2018, 16:04

18 Jan 2018, 18:01

You need to add an id to pa tag. For example:

Code: Select all

<pa:menu id="yourID" widgetVar="me" model="#{menu.model}"/>
Best Regards

Post Reply

Return to “Barcelona - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests