Kendo

  • Kendo UI
  • Demos
  • Roadmap
  • Download Beta

Skin

  • Framework
  • UI Widgets
  • Integration

    Configuration API Functions
    • First Item
      • Sub Item 1
      • Sub Item 2
      • Sub Item 3
      • Sub Item 4
    • Second Item
      • Sub Item 1
      • Sub Item 2
      • Sub Item 3
      • Sub Item 4
    • Third Item
      • Sub Item 1
      • Sub Item 2
      • Sub Item 3
      • Sub Item 4
    • Fourth Item
      • Sub Item 1
      • Sub Item 2
      • Sub Item 3
      • Sub Item 4
    • Fifth Item
      • Sub Item 1
      • Sub Item 2
      • Sub Item 3
      • Sub Item 4
    • Description
    • View Code
    • Configuration (2)
    • Methods (9)
    • Events (5)

    The PanelBar widget displays hierarchical data as a multi-level expandable panel bar. PanelBar structure can be defined statically in HTML or configured dynamically with the PanelBar API. Content for PanelBar items can also be easily loaded with Ajax simply by specifying the content URL.

    Getting Started

    Create a simple HTML hierarchical list of items

     <ul id="panelbar">
         <li>Item 1
             <ul>
                 <li>Sub Item 1</li>
                 <li>Sub Item 2</li>
             </ul>
         <li>
         <li>Item 2</li>
         <li>Item with Content
             <div>This is some PanelBar Item content</div>
         </li>
     </ul>

    Initialize Kendo PanelBar using jQuery selector

    var panelBar = $("#panelBar").kendoPanelBar();

    Items in a PanelBar can optionally define in-line HTML content. To add content, simply place the HTML inside of a div. Text content outside of the div will be used as the Item's PanelBar text.

    Loading Content with Ajax

    While any valid technique for loading Ajax content can be used, PanelBar provides built-in support for asynchronously loading content from URLs. These URLs should return HTML fragments that can be loaded in the PanelBar item content area.


    When PanelBar loads content with Ajax, it is cached so that subsequent expand/collapse actions do not re-trigger the Ajax request.

    Loading PanelBar content asynchronously

     <!-- HTML structure -->
     <ul id="panelbar">
         <li>Item 1
             <ul>
                 <li>Sub Item 1</li>
             </ul>
         </li>
         <li>Item 2</li>
         <li>
             Item with Dynamic Content
             <div></div>
         </li>
     </ul>

     //JavaScript initialization and configuration
     $(document).ready(function(){
         $("#panelbar").kendoPanelBar({
             contentUrls:[
               null,
               null,
               "html-content-snippet.html"
             ]
         });
     });

    Customizing PanelBar Animations

    By default, the PanelBar uses a slide animation to expand and reveal sub-items as the mouse hovers. Animations can be easily customized using configuration properties, changing the open and close animation style. A PanelBar can also be configured to only allow one panel to remain open at a time.

    Changing PanelBar animation and expandMode behavior

     $("#panelbar").kendoPanelBar({
         animation: {
             open : {effects: fadeIn}
         },
         expandMode: "single"
     });

    Dynamically configuring PanelBar items

    The PanelBar API provides several methods for dynamically adding or removing Items. To add items, provide the new item as a JSON object along with a reference item that will be used to determine the placement in the hierarchy.


    A reference item is simply a target PanelBar Item HTML element that already exists in the PanelBar. Any valid jQuery selector can be used to obtain a reference to the target item. For examples, see the PanelBar API demos.


    Removing an item only requires a reference to the target element that should be removed.

    Dynamically add a new root PanelBar item

     var pb = $("#panelbar").kendoPanelBar().data("kendoPanelBar");
     pb.insertAfter(
         { text: "New PanelBar Item" },
         pb.element.children("li:last")
     );
    No code
    animation: Object
    A collection of Animation objects, used to change default animations. A value of false will disable all animations in the component.
    close: Animation
    The animation that will be used when collapsing items.
    open: Animation
    The animation that will be used when expanding items.
    expandMode: String(default: multiple)
    Specifies if PanelBar should collapse the already expanded item when expanding next item
    • append (item, referenceItem)
      Appends a PanelBar item in the specified referenceItem

      Example

      panelBar.append(
          [{
              text: "Item 1"
          },
          {
              text: "Item 2"
          }],
          referenceItem
      );

      Parameters

      item: Selector
      Target item, specified as a JSON object. Can also handle an array of such objects.
      referenceItem: Item
      A reference item to append the new item in
    • collapse (element, useAnimation)
      Collapses the specified PanelBar item/s

      Example

      panelBar.collapse("#Item1");

      Parameters

      element: Selector
      Target item selector.
      useAnimation: Boolean
      Use this parameter to temporary disable the animation.
    • disable (element)
      Disables a PanelBar item

      Parameters

      element: Selector
      Target element
    • enable (element, enable)
      Enables/disables a PanelBar item

      Parameters

      element: Selector
      Target element
      enable: Boolean
      Desired state
    • expand (element, useAnimation)
      Expands the specified PanelBar item/s

      Example

      panelBar.expand("#Item1");

      Parameters

      element: Selector
      Target item selector.
      useAnimation: Boolean
      Use this parameter to temporary disable the animation.
    • insertAfter (item, referenceItem)
      Inserts a PanelBar item after the specified referenceItem

      Example

      panelBar.insertAfter(
          [{
              text: "Item 1"
          },
          {
              text: "Item 2"
          }],
          referenceItem
      );

      Parameters

      item: Selector
      Target item, specified as a JSON object. Can also handle an array of such objects.
      referenceItem: Item
      A reference item to insert the new item after
    • insertBefore (item, referenceItem)
      Inserts a PanelBar item before the specified referenceItem

      Example

      panelBar.insertBefore(
          [{
              text: "Item 1"
          },
          {
              text: "Item 2"
          }],
          referenceItem
      );

      Parameters

      item: Selector
      Target item, specified as a JSON object. Can also handle an array of such objects.
      referenceItem: Item
      A reference item to insert the new item before
    • remove (element)
      Removes the specified PanelBar item/s

      Example

      panelBar.remove("#Item1");

      Parameters

      element: Selector
      Target item selector.
    • select (element)
      Selects the specified PanelBar item/s. If called without arguments - returns the selected item.

      Example

      panelBar.select("#Item1");

      Parameters

      element: Selector
      Target item selector.
    collapse
    Fires before an item is collapsed.

    Event data

    item : Element
    The collapsing item
    contentLoad
    Fires when content is fetched from an ajax request.

    Event data

    item : Element
    The selected item
    item : Element
    The loaded content element
    error
    Fires when ajax request results in an error.

    Event data

    xhr : jqXHR
    The jqXHR object used to load the content
    status : String
    The returned status.
    expand
    Fires before an item is expanded.

    Event data

    item : Element
    The expanding item
    select
    Fires before an item is selected.

    Event data

    item : Element
    The selected item
    • Home
    • Kendo UI
    • Demos
    • Roadmap
    • Blogs
    • Forums
    • Documentation
    • FAQ
    • About
    • Follow us on Twitter
    • Subscribe to our RSS feed

    Kendo UI is powered by Telerik

    Copyright © 2011 Telerik Inc. All rights reserved.