How to hide child topics in employee center mega menu

mtymytk
Tera Expert
Hi,

I would like to hide the topics on the 3rd level of the Employee Center mega menu.
For example, in the attached image, I want to display up to Hardware, Software, Network which are child topics of IT but not Computers and any other below Computers.
 
image.png 

 

 

reference:
17 REPLIES 17

Hi, I am also curious as to whether you found a solution for this.  I also would like to hide a Child Topic 2 (e.g., Printers) from the Mega Menu, but have it still appear as a child topic when you visit the Child Topic 1 (e.g. Hardware) topic page in EC.  Thanks in advance...  

Community Alums
Not applicable

Hello @mtymytk ,

You can hide hide the topics on the 3rd level of the Employee Center mega menu.

For this u need to remove connected content of that child topic.

Khushbookabra_0-1678813700002.png

After removing connected content logout & then login back to the instance. (Pls note sometime it will take few hours to reflect the changes in portal).

Result :

Khushbookabra_1-1678813722065.png

 

If there will be one connected content then it will be visible to you. So if you don't want to show it in mega menu then please remove its connected contents.

 

@mtymytk , please mark my answer as accepted solution and helpful. If it is works for you.

 

Thank you.

Is there a way to remove the Browse All button from a third menu of our own in the Mega menu .. .but keep it to  the IT menu

mak1A4
Tera Guru

@mtymytk it is possible to hide the 3rd level of topics in the mega menu by creating a UI-Script in the global scope with the following code:

(function() {

    function waitForElement(selector, timeout, interval) {
        return new Promise(function(resolve, reject) {
            var elapsedTime = 0;
            var checkForElement = function() {
                var element = document.querySelector(selector);
                if (element) {
                    resolve(element);
                } else if (elapsedTime >= timeout) {
                    reject(new Error("waitForElement: Timeout exceeded while waiting for element with selector >> " + selector));
                } else {
                    elapsedTime += interval;
                    setTimeout(checkForElement, interval);
                }
            };
            checkForElement();
        });
    }

    waitForElement(".v045301ddeb503010ed7966d647522844", 30000, 100).then(function(element) {
        var ecnavScope = angular.element(element).scope();
        if (!ecnavScope) return;

        var menuItemIds = new Set(ecnavScope.data.menuItems.map(function(item) {
            return item.sys_id;
        }));
        for (var key in ecnavScope.data.menuItemToChildrenMap) {
            if (!menuItemIds.has(key)) {
                delete ecnavScope.data.menuItemToChildrenMap[key];
            }
        }
    });
})();

You have to create a JS Include Dependency for that UI-Script and add it to your EC Portal Theme, then all 3rd Level Topics will be hidden.

MichaelCreatura
Tera Guru

Hello,

 

Did anyone get a resolution to this?

We are having the same issue in that we want to hide the child topic of a child topic in the mega menu.

MichaelCreatura_0-1697730952396.png

But we still want to be able to access it from the parent topic page so removing the connected content is not possible:

MichaelCreatura_1-1697731034152.png


Thanks, 
Michael