Close panelbar

2 posts, 1 answers
  1. Anders
    Anders avatar
    10 posts
    Member since:
    Aug 2012

    Posted 31 Jan 2012 Link to this post

    I have a panelBar with expandMode 'single'. Can I make it collapse when I click on a expanden item.
    I want my user to be abel to collapse all items.
  2. Answer
    Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 31 Jan 2012 Link to this post

    Hi Anders,

    You can use the PanelBar's select event, check whether the currently clicked item is already expanded and if so, collapse it via the API.

    function expandCollapse(e) {
        if ($(e.item).is(".k-state-active")) {
            var that = this;
            window.setTimeout(function(){that.collapse(e.item);}, 1);
        }
    }
     
    var panelBar = $("#panelbar").kendoPanelBar({
        expandMode: "single",
        select: expandCollapse
    }).data("kendoPanelBar");


    Greetings,
    Dimo
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
Back to Top