Paradise theme left menu not getting highlighted properly

Forum rules
Please note that response time for technical support is within 3-5 business days.
Post Reply
koushik_m100
Posts: 27
Joined: 05 Oct 2016, 14:32

01 May 2020, 08:55

Hi,
We are developing an application using the Paradise theme. Whenever we are lading in the pages, the previously visited left menu is getting highlighted rather than presently visited menu. It seems clearMenuState method of layout.js not working properly. Do you have any insight how to address this issue?
Koushik Mitra
Koushik Mitra

koushik_m100
Posts: 27
Joined: 05 Oct 2016, 14:32

04 May 2020, 12:30

I found an alternative way to fix it.

1. Removed framework specified active-menuitem class using jquery
$(document.getElementById('menuId')).removeClass('active-menuitem');

2. Created alternative style class highlightVisitedMenu
.highlightVisitedMenu {
background-color: red !important;
color: Yellow !important;
}
3. <p:menuitem value="Menu Name" icon="[Relevant Icon]" id="menuId"
outcome="menuOutcome"
styleClass="#{view.viewId == 'page.xhtml' ? 'highlightVisitedMenu ' : ''}" />
Koushik Mitra

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

03 Jun 2020, 10:55

Could you please attach your menu's code? Do you update the menu after calling clearMenuState?

Best Regards,

koushik_m100
Posts: 27
Joined: 05 Oct 2016, 14:32

03 Jun 2020, 14:31

I thought clearMenuState will be invoked by the framework only. Do I need to call the clearMenuState method explicitly and update the menu form? do you have any code snippet or example or reference to have a look?

The actual code I can not post. If I understand what you are asking so I can write a similar code stub and post.

Regards
Koushik Mitra

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

24 Jun 2020, 09:08

Please try;

Code: Select all

<script type="text/javascript">
    //<![CDATA[
$(function() {
    var widget = PF('paradiseMenuWidget');

    if (widget) {
        widget.clearMenuState();
        
        var activeMenuItems = widget.jq.find('li.active-menuitem');
        for (var i = 0; i < activeMenuItems.length; i++) {
            var menuitem = activeMenuItems.eq(i);
            menuitem.removeClass('active-menuitem');

            var submenu = menuitem.children('ul');
            if(submenu.length) {
                submenu.hide();
            }
        }
    }
    
})
    //]]>
    </script>
<pv:menu widgetVar="paradiseMenuWidget">

Best Regards,

Post Reply

Return to “Paradise - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests