Active Menu Tab

1
I would like to change my default Mendix Active Menu Tab without click on the menu but set it active on page load/in a microflow.
asked
3 answers
2

My read of this question is a little bit different than Simon's. The Mendix built-in menus don't show an "Active" page/tab/option when you open the page from some other source - like a button or the default home page.

I had to work around this issue on a mobile device - I used the HTMLSnippet widget on my page to put some Javascript in place:

window.setMenu = function() {
    if (dijit.registry.byClass("mxui.widget.MenuBar").length > 0) {
        dijit.registry.byClass("mxui.widget.MenuBar").forEach(function(m) {
            m._currentSelection = 4;
            m._restoreSelection();
        });
    } else {
        setTimeout(window.setMenu, 250);
    }
};

window.setMenu();

This code might be specific to the mobile menu bar, but I'm sure it could be modified to work with the desktop menu as well. The idea is that this code runs when the page loads, and runs every .25 seconds until it finds a specific menu bar item (in this example the 5th one), and then adds the "active" class to it.

answered
1

You probably looking for something like this then: https://appstore.home.mendix.com/link/app/2964/First-Consulting/TabSwitcher

answered
1

I would say use my TabSwitcher-widget indeed. You can add a microflow giving an integer output to set the active tab pane of the tab container.

answered