Icarus menu active item highlighting not working correctly

Post Reply
matrix
Posts: 5
Joined: 11 Aug 2016, 08:45

26 Sep 2016, 09:51

Hello,
we have a question when using the Icarus menu in non-ajax way like in the showcase e.g. on http://www.primefaces.org/icarus/forms.xhtml
When first selecting a menu entry, it is highlighted and thus marked as active.
However, this does not work when selecting the same menu entry again, e.g. when selecting "Forms" from within the Components > Forms page from the showcase.

Is this intended behaviour?
How could it be changed so that the currently selected menu entry is always highlighted?

User avatar
aragorn
Posts: 2697
Joined: 29 Jun 2013, 12:38

06 Oct 2016, 14:14

Thanks for the detailed description. Fixed for next version; https://github.com/primefaces/layouts/issues/126

matrix
Posts: 5
Joined: 11 Aug 2016, 08:45

07 Oct 2016, 09:40

Thank you!

User avatar
aragorn
Posts: 2697
Joined: 29 Jun 2013, 12:38

07 Oct 2016, 09:48

You're welcome ;) For now, you can change the click event of menulinks in bindEvents method in the layout.js. Please try;

Code: Select all

bindEvents: function() {        
       
        ...

        this.menulinks.on('click',function(e) {
            var menuitemLink = $(this),
            menuitem = menuitemLink.parent(),
            hasSubmenuContainer = menuitemLink.next().is('ul'),
            isActive = menuitem.hasClass('active-menu-parent');
            
            if($this.menubar.width() < 60) {
                $this.toggleMenu();
                
                if(!isActive) {
                    setTimeout(function() {
                        $this.activateMenuitem(menuitem);
                    }, 300);
                }
            }
            else if(hasSubmenuContainer) {
                if(isActive)
                    $this.deactivateMenuitem(menuitem);
                else
                    $this.activateMenuitem(menuitem);
            }
            else if(!isActive) {
                $this.activateMenuitem(menuitem);
            }

            if(hasSubmenuContainer) {
                e.preventDefault();
            }

            $this.saveMenuState();    
            
            setTimeout(function() {
                $(".nano").nanoScroller();
            }, 750);
        });
    
      ...
        
    },

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest