This is a migrated thread and some comments may be shown as answers.

Hide top leve items without children

2 Answers 44 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Benjamin
Top achievements
Rank 1
Benjamin asked on 31 Jan 2014, 11:45 PM
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 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 03 Feb 2014, 11:22 AM
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!
0
Benjamin
Top achievements
Rank 1
answered on 03 Feb 2014, 02:31 PM
Thank you, That worked perfectly.
Tags
PanelBar
Asked by
Benjamin
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Benjamin
Top achievements
Rank 1
Share this question
or