Custom Menu - Style

Posted by jts-law on 23-Oct-2017 10:43

Hi All,

In my KUIB app I generate the menu based on the users access within the system.  I'm using the following code to generate the menu for this module.  When the menu template is generated, I'm not setting all of the classes/style that get assigned when the menu is rendered so it appears in a larger font, then shrinks down to the final size.  While functionally it works, I don't like the way it changes sizes, and I haven't figured out exactly what class' I need to put in the template.  What do I need to add to my template so the formatting is correct to begin with?

    let state = $state.get('module.default');
    if (state && state.views && state.views['side-navigation']) {
        state.views['side-navigation'].templateUrl = "";  // Don't allow default menu
        /* Send request to get menus */
        prmService.getMenus('Parameters').then(
            (res) => {
                let ttMenus = res.ttMenus;
                let htmlMenu  = '<ul kendo-panelbar="widget">' +
                                '   <li data-state="module.default.parameters" title="Parameters">' +
                                '      <i class="fa fa-cog"></i>' +
                                '      <span>Parameters</span>' +
                                '      <ul>';
                ttMenus.forEach((menu, index) => {
                    htmlMenu += '         <li class="nav-item" data-state="' +
                                            menu.dataState + '" title="' + menu.menuTitle + '">' +
                                '            <a class="k-link" ui-sref="' + menu.dataState + '">' +
                                '               <span>' + menu.menuName + '</span>' +
                                '            </a>'
                                '         </li>';
                });
                htmlMenu += '</ul></li></ul>';
                state.views['side-navigation'].template = htmlMenu;
            }
        )
    }

Louis

All Replies

This thread is closed