Incorrectly selecting/activating menu tab

Post Reply
eframsergio
Posts: 1
Joined: 11 Jul 2019, 18:40

10 Aug 2020, 19:28

The Prestige layout theme does not update currently selected tab.

1) When initially opening prestige layout live demo, the following tabs show as follows:

[*DASHBOARD][COMPONENTS][PAGES][HIERARCHY][DOCUMENTATION][BUY NOW]

The dashboard tab correctly shows as selected/active.

2) Now, open prestige layout live demo on another browser tab and select the documentation tab

[DASHBOARD][COMPONENTS][PAGES][HIERARCHY][*DOCUMENTATION][BUY NOW]

Now, the documentation tab correctly shows as selected/active.

3) Go back to first browser tab and refresh.

[DASHBOARD][COMPONENTS][PAGES][HIERARCHY][*DOCUMENTATION][BUY NOW]

Tabs continue showing the documentation tab as selected/active, but with the dashboard contents inside.

Tested it on latest version of chrome, internet explorer and edge.

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

26 Aug 2020, 14:28

Thanks a lot for the feedback. We are using cookie to store selected menuitem. Maybe, we can add different options for this work. Exp; local-storage, session-storage and cookie

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

26 Aug 2020, 14:50

Please try;

Code: Select all

<script type="text/javascript">
//<![CDATA[
/** 
 * PrimeFaces Prestige Layout
 */
 PrimeFaces.widget.Prestige = PrimeFaces.widget.Prestige.extend({

    saveMenuState: function() {
        sessionStorage.setItem('prestige_expandeditems', this.expandedMenuitems.join(','));
        //$.cookie('paradise_expandeditems', this.expandedMenuitems.join(','), {path: '/'});
    },
    
    saveScrollState: function (value) {
        sessionStorage.setItem('prestige_scroll', value);
        //$.cookie('prestige_scroll', value, { path: '/' });
    },

    clearMenuState: function() {
        sessionStorage.removeItem('prestige_expandeditems');
        sessionStorage.removeItem('prestige_scroll');
        //$.removeCookie('prestige_expandeditems', {path: '/'});
        //$.removeCookie('prestige_scroll', { path:'/' });
    },
    
    restoreMenuState: function() {
        //var menucookie = $.cookie('paradise_expandeditems');
        var menucookie = sessionStorage.getItem('prestige_expandeditems');
        if (menucookie) {
            var isHorizontal = this.wrapper.hasClass('layout-menu-horizontal');
            this.expandedMenuitems = menucookie.split(',');
            for (var i = 0; i < this.expandedMenuitems.length; i++) {
                var id = this.expandedMenuitems[i];
                if (id) {
                    var menuitem = $("#" + this.expandedMenuitems[i].replace(/:/g, "\\:"));
                    menuitem.addClass('active-menuitem');

                    var submenu = menuitem.children('ul');
                    if (submenu.length) {
                        var isRootMenuitem = menuitem.parent().is(this.jq);

                        if (isHorizontal && isRootMenuitem) {
                            submenu.hide();
                        }
                        else {
                            submenu.show();
                        }
                    }
                }
            }
        }
        else if (this.isHorizontalMenu()) {
            var firstRootItem = this.rootMenuitems.eq(0);
            firstRootItem.addClass('active-menuitem');
            this.addMenuitem(firstRootItem.attr('id'));
        }
    }
});
//]]>
</script>
Best Regards,

Post Reply

Return to “Prestige - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest