Hide top leve items without children

3 posts, 0 answers
  1. Benjamin
    Benjamin avatar
    5 posts
    Member since:
    Dec 2013

    Posted 31 Jan 2014 Link to this post

    I'm using the panelbar to display links to different internal applications that I have grouped together into several different sections on a password protected intranet.
    I really like that the links for actions are not displayed when a user does not have acquitted permissions to execute them.

    However I'm left with top level items without any child items that are displayed. Is there a simple way to hide the top level items without any children?

  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2156 posts

    Posted 03 Feb 2014 Link to this post

    Hi Benjamin,


    To achieve this you could manually check if a parent item contains child items or not and hide it if this condition is not satisfied. Here is a sample implementation.
    E.g.
    $(function () {
        var pb = $("#panelbar").data("kendoPanelBar");
        var topLevelItems = pb.wrapper.find(">li");
        topLevelItems.each(function () {
            if ($(this).find(">.k-group").length === 0) {
                pb.remove(this);
            }
        });
    });


    Regards,
    Dimiter Madjarov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Benjamin
    Benjamin avatar
    5 posts
    Member since:
    Dec 2013

    Posted 03 Feb 2014 in reply to Dimiter Madjarov Link to this post

    Thank you, That worked perfectly.
Back to Top