title | page_title | description |
---|---|---|
PanelBar |
Configuration, methods and events of Kendo UI PanelBar |
Configure the PanelBar UI widget, use methods and explore the events which are triggered upon certain behaviors. |
Represents the Kendo UI PanelBar widget. Inherits from Widget.
A collection of visual animations used when PanelBar items are expand or collapsed through
user interactions. Setting this option to false
will disable all animations.
animation:true
is not a valid configuration.
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar({
animation: {
// fade-out closing items over 1000 milliseconds
collapse: {
duration: 1000,
effects: "fadeOut"
},
// fade-in and expand opening items over 500 milliseconds
expand: {
duration: 500,
effects: "expandVertical fadeIn"
}
}
});
</script>
The visual animation(s) that will be used when PanelBar items are closed.
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar({
animation: {
collapse: {
duration: 200,
effects: "fadeOut"
}
}
});
</script>
The number of milliseconds used for the visual animation when a PanelBar item is closed.
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar({
animation: {
collapse: {
duration: 1000
}
}
});
</script>
A whitespace-delimited string of animation effects that are utilized when a PanelBar item is closed. Options include "fadeOut".
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar({
animation: {
collapse: {
duration: 1000,
effects: "fadeOut"
}
}
});
</script>
The visual animation(s) that will be used when opening items.
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar({
animation: {
expand: {
duration: 200,
effects: "expandVertical"
}
}
});
</script>
The number of milliseconds used for the visual animation when an item is opened.
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar({
animation: {
expand: {
duration: 1000
}
}
});
</script>
A whitespace-delimited string of animation effects that are used when an item is expanded. Options include "expandVertical" and "fadeIn".
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar({
animation: {
expand: {
effects: "expandVertical"
}
}
});
</script>
If set to false
the widget will not bind to the data source during initialization. In this case data binding will occur when the change event of the
data source is fired. By default the widget will bind to the data source specified in the configuration.
Setting
autoBind
tofalse
is useful when multiple widgets are bound to the same data source. Disabling automatic binding ensures that the shared data source does not make more than one request to the remote service.
<div id="panelbar"></div>
<script>
var dataSource = new kendo.data.HierarchicalDataSource({
data: [ { text: "Jane Doe" }, { text: "John Doe" }]
});
$("#panelbar").kendoPanelBar({
autoBind: false,
dataSource: dataSource
});
dataSource.read(); // "read()" will fire the "change" event of the dataSource and the widget will be bound
</script>
Sets an array with the URLs from which the PanelBar items content to be loaded from. If only specific items should be loaded via Ajax, then you should set the URLs to the corresponding positions in the array and set the other elements to null.
<ul id="panelbar">
<li>Item 1
<div>Content 1</div>
</li>
<li>
Ajax Item
<div></div>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar({
contentUrls: [
null,
"http://demos.telerik.com/kendo-ui/content/web/panelbar/ajax/ajaxContent1.html"
]
});
</script>
Sets the field of the data item that provides the image URL of the PanelBar nodes.
<div id="panelbar"></div>
<script>
var items = [
{ text: "Baseball", image: "http://demos.telerik.com/kendo-ui/content/shared/icons/sports/baseball.png" },
{ text: "Golf", image: "http://demos.telerik.com/kendo-ui/content/shared/icons/sports/golf.png" }
];
$("#panelbar").kendoPanelBar({
dataImageUrlField: "image",
dataSource: items
});
</script>
The data source of the widget which is used render nodes. Can be a JavaScript object which represents a valid data source configuration, a JavaScript array or an existing kendo.data.HierarchicalDataSource instance.
If the dataSource
option is set to a JavaScript object or array the widget will initialize a new kendo.data.HierarchicalDataSource instance using that value as data source configuration.
If the dataSource
option is an existing kendo.data.HierarchicalDataSource instance the widget will use that instance and will not initialize a new one.
<div id="panelbar"></div>
<script>
$("#panelbar").kendoTreeView({
dataSource: {
data: [
{ text: "foo", items: [
{ text: "bar" }
] }
]
}
});
</script>
<script>
$("#panelbar").kendoPanelBar({
dataSource: [
{
text: "Item 1 (link)",
cssClass: "myClass", // Add custom CSS class to the item, optional, added 2012 Q3 SP1.
url: "http://www.kendoui.com/" // link URL if navigation is needed (optional)
},
{
text: "<b>Item 2</b>",
encoded: false, // Allows use of HTML for item text
content: "text" // content within an item
},
{
text: "Item 3",
// content URL to load within an item
contentUrl: "http://demos.telerik.com/kendo-ui/content/web/panelbar/ajax/ajaxContent1.html"
},
{
text: "Item 4",
// item image URL, optional
imageUrl: "http://demos.telerik.com/kendo-ui/content/shared/icons/sports/baseball.png",
expanded: true, // item is rendered expanded
items: [{ // Sub item collection.
text: "Sub Item 1"
},
{
text: "Sub Item 2"
}]
},
{
text: "Item 5"
}
]
});
</script>
<div id="panelbar"></div>
<script>
var dataSource = new kendo.data.HierarchicalDataSource({
transport: {
read: {
url: "http://demos.telerik.com/kendo-ui/service/Employees",
dataType: "jsonp"
}
},
schema: {
model: {
id: "EmployeeId",
hasChildren: "HasEmployees"
}
}
});
$("#panelbar").kendoPanelBar({
dataSource: dataSource,
dataTextField: "FullName"
});
</script>
Sets the field of the data item that provides the sprite CSS class of the nodes. If an array, each level uses the field that is at the same index in the array, or the last item in the array.
<style>
#panelbar .k-sprite {
background-image: url("http://demos.telerik.com/kendo-ui/content/shared/styles/flags.png");
}
</style>
<div id="panelbar"></div>
<script>
var items = [
{ text: "Brazil", sprite: "brazilFlag" },
{ text: "India", sprite: "indiaFlag" }
];
$("#panelbar").kendoPanelBar({
dataSpriteCssClassField: "sprite",
dataSource: items
});
</script>
Sets the field of the data item that provides the text content of the nodes. If an array, each level uses the field that is at the same index in the array, or the last item in the array.
<div id="panelbar"></div>
<script>
var items = [
{ ProductName: "Tea", items: [
{ ProductName: "Green Tea" },
{ ProductName: "Black Tea" }
] },
{ ProductName: "Coffee" }
];
$("#panelbar").kendoPanelBar({
dataTextField: "ProductName",
dataSource: items
});
</script>
<div id="panelbar"></div>
<script>
var items = [
{ CategoryName: "Tea", items: [
{ ProductName: "Green Tea" },
{ ProductName: "Black Tea" }
] },
{ CategoryName: "Coffee" }
];
$("#panelbar").kendoPanelBar({
dataTextField: [ "CategoryName", "ProductName" ],
dataSource: items
});
</script>
Sets the field of the data item that provides the link URL of the nodes.
<div id="panelbar"></div>
<script>
var items = [
{ text: "Tea", LinksTo: "http://tea.example.com" },
{ text: "Coffee", LinksTo: "http://coffee.example.com" }
];
$("#panelbar").kendoPanelBar({
dataUrlField: "LinksTo",
dataSource: items
});
</script>
Specifies how the PanelBar items are displayed when opened and closed. The following values are available:
Display one item at a time when an item is opened; opening an item will close the previously opened item.
Display multiple values at one time; opening an item has no visual impact on any other items in the PanelBar.
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar({
expandMode: "single"
});
</script>
Indicates whether the child DataSources should be fetched lazily when parent groups get expanded. Setting this to false causes all child DataSources to be loaded at initialization time.
<div id="panelbar"></div>
<script>
$("#panelbar").kendoPanelBar({
loadOnDemand: true,
dataSource: [
{ text: "foo", items: [
{ text: "bar" }
] }
]
});
</script>
The text messages displayed in the widget. Use it to customize or localize the messages.
<div id="panelbar"></div>
<script>
$("#panelbar").kendoPanelBar({
dataSource: {
transport: {
read: function(options) {
// request always fails after 1s
setTimeout(function() {
options.error({});
}, 1000);
}
}
},
messages: {
retry: "Wiederholen",
requestFailed: "Anforderung fehlgeschlagen.",
loading: "Laden..."
}
});
</script>
The text message shown while the root level items are loading.
<div id="panelbar"></div>
<script>
$("#panelbar").kendoPanelBar({
dataSource: {
transport: {
read: function(options) {
// request always fails after 1s
setTimeout(function() {
options.error({});
}, 1000);
}
}
},
messages: {
loading: "Laden..."
}
});
</script>
The text message shown when an error occurs while fetching the content.
<div id="panelbar"></div>
<script>
$("#panelbar").kendoPanelBar({
dataSource: {
transport: {
read: function(options) {
// request always fails after 1s
setTimeout(function() {
options.error({});
}, 1000);
}
}
},
messages: {
requestFailed: "Anforderung fehlgeschlagen."
}
});
</script>
The text message shown in the retry button.
<div id="panelbar"></div>
<script>
$("#panelbar").kendoPanelBar({
dataSource: {
transport: {
read: function(options) {
// request always fails after 1s
setTimeout(function() {
options.error({});
}, 1000);
}
}
},
messages: {
retry: "Wiederholen"
}
});
</script>
Template for rendering each node.
<div id="panelbar"></div>
<script>
$("#panelbar").kendoPanelBar({
template: "#= item.text # (#= item.inStock #)",
dataSource: [
{ text: "foo", inStock: 7, items: [
{ text: "bar", inStock: 2 },
{ text: "baz", inStock: 5 }
] }
]
});
</script>
Appends an item(s) to the PanelBar.
<ul id="panelbar"></ul>
<script>
$("#panelbar").kendoPanelBar();
var panelBar = $("#panelbar").data("kendoPanelBar");
panelBar.append(
[
{
text: "Item 1",
cssClass: "myClass", // Add custom CSS class to the item, optional, added 2012 Q3 SP1.
url: "http://www.telerik.com/" // link URL if navigation is needed, optional.
},
{
text: "<b>Item 2</b>",
encoded: false, // Allows use of HTML for item text
content: "text" // content within an item
},
{
text: "Item 3",
contentUrl: "http://demos.telerik.com/kendo-ui/content/web/panelbar/ajax/ajaxContent1.html"
},
{
text: "Item 4",
imageUrl: "http://demos.telerik.com/kendo-ui/content/shared/icons/sports/baseball.png",
expanded: true, // item is rendered expanded
items: [{ // Sub item collection.
text: "Sub Item 1"
},
{
text: "Sub Item 2"
}]
},
{
text: "Item 5",
// item image sprite CSS class, optional
spriteCssClass: "imageClass3"
}
]
);
</script>
Target item, specified as the JSON representation of an object. You can pass item text
, content
or
contentUrl
here. Can handle an HTML string or array of such strings or JSON.
A reference item to append the new item in the PanelBar, can be omitted.
kendo.ui.PanelBar
Returns the PanelBar object to support chaining.
Clears the currently selected PanelBar items.
<ul id="panelbar">
<li id="item1">Item 1</li>
<li id="item2">Item 2</li>
</ul>
<script>
// create a PanelBar instance and get it.
var panelBar = $("#panelbar").kendoPanelBar().data("kendoPanelBar");
// select the element with ID "item1"
panelBar.select($("#item1"));
// select the element with ID "item2"
panelBar.select($("#item2"));
// clear all selection
setTimeout(function() {
panelBar.clearSelection();
}, 2000);
</script>
Collapses the specified item(s) of a PanelBar.
<ul id="panelbar">
<li id="item1">Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li id="item2">Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar();
// access an existing PanelBar instance
var panelBar = $("#panelbar").data("kendoPanelBar");
// collapse the element with ID, "item1"
panelBar.collapse($("#item1"));
// collapse the element with ID, "item2" without visual animations
panelBar.collapse($("#item2"), false);
// collapse all list items that start with ID, "item"
panelBar.collapse($('[id^="item"]'));
</script>
The PanelBar item(s) to be collapsed, expressed as a string containing a selector expression or represented by a jQuery selector.
_optional, default: _
Temporarily enables (true) or disables (false) any visual animation(s) when collapsing items.
kendo.ui.PanelBar
Returns the PanelBar object to support chaining.
Prepares the PanelBar for safe removal from DOM. Detaches all event handlers and removes jQuery.data attributes to avoid memory leaks. Calls destroy method of any child Kendo widgets.
Important: This method does not remove the PanelBar element from DOM.
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar();
var panelBar = $("#panelbar").data("kendoPanelBar");
// detach events
panelBar.destroy();
</script>
Enables (true) or disables (false) the specified item(s) of the PanelBar.
<ul id="panelbar">
<li id="item1">Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li id="item2">Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar();
// access an existing PanelBar instance
var panelBar = $("#panelbar").data("kendoPanelBar");
// enable the item of the PanelBar with ID, "item1"
panelBar.enable($("#item1"), true);
// disable the currently selected item of the PanelBar
var item = panelBar.select();
panelBar.enable($("#item2"), false);
// disable all list items that start with ID, "item"
panelBar.enable($('[id^="item"]'), false);
</script>
The PanelBar item(s) to be enabled (true) or disabled (false), expressed as a string containing a selector expression or represented by a jQuery selector.
The desired state - enabled (true) or disabled (false) - of the target element(s).
Expands the specified item(s) of a PanelBar.
<ul id="panelbar">
<li id="item1">Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li id="item2">Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar();
// access an existing PanelBar instance
var panelBar = $("#panelbar").data("kendoPanelBar");
// expand the element with ID, "item1"
panelBar.expand($("#item1"));
// expand the element with ID, "item2" without visual animations
panelBar.expand($("#item2"), false);
// expand all list items that start with ID, "item"
panelBar.expand($('[id^="item"]'));
</script>
The PanelBar item(s) to be expanded, expressed as a selector.
_optional, default: _
Temporarily enables (true) or disables (false) any visual animation(s) when expanding items.
kendo.ui.PanelBar
Returns the PanelBar object to support chaining.
Inserts a PanelBar item after the specified referenceItem
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar();
var panelBar = $("#panelbar").data("kendoPanelBar");
panelBar.insertAfter(
[{
text: "Item 1",
url: "http://www.telerik.com" // Link URL if navigation is needed, optional.
},
{
text: "<b>Item 2</b>",
encoded: false, // Allows use of HTML for item text
content: "text" // Content for the content element
},
{
text: "Item 3",
contentUrl: "http://demos.telerik.com/kendo-ui/content/web/panelbar/ajax/ajaxContent1.html"
},
{
text: "Item 4",
imageUrl: "http://demos.telerik.com/kendo-ui/content/shared/icons/sports/baseball.png",
expanded: true, // item is rendered expanded
items: [{ // Sub item collection.
text: "Sub Item 1"
},
{
text: "Sub Item 2"
}]
},
{
text: "Item 5"
}],
"li:first-child"
);
</script>
Target item, specified as a JSON object. You can pass item text
, content
or contentUrl
here. Can handle an HTML string or array of such strings or JSON.
A reference item to insert the new item after
Inserts a PanelBar item before the specified referenceItem
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar();
var panelBar = $("#panelbar").data("kendoPanelBar");
panelBar.insertBefore(
[{
text: "Item 1",
url: "http://www.telerik.com" // Link URL if navigation is needed, optional.
},
{
text: "<b>Item 2</b>",
encoded: false, // Allows use of HTML for item text
content: "text" // Content for the content element
},
{
text: "Item 3",
contentUrl: "http://demos.telerik.com/kendo-ui/content/web/panelbar/ajax/ajaxContent1.html"
},
{
text: "Item 4",
imageUrl: "http://demos.telerik.com/kendo-ui/content/shared/icons/sports/baseball.png",
expanded: true, // item is rendered expanded
items: [{ // Sub item collection.
text: "Sub Item 1"
},
{
text: "Sub Item 2"
}]
},
{
text: "Item 5"
}],
"li:last-child"
);
</script>
Target item, specified as a JSON object. You can pass item text
, content
or contentUrl
here. Can handle an
TML string or array of such strings or JSON.
A reference item to insert the new item before.
kendo.ui.PanelBar
Returns the PanelBar object to support chaining.
Reloads the content of a PanelBar from an AJAX request.
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar();
// get a reference to the panel bar
var panelBar = $("#panelbar").data("kendoPanelBar");
// reload the panel bar
panelBar.reload("> .k-item");
</script>
Target element
Removes the specified PanelBar item(s).
<ul id="panelbar">
<li id="Item1">Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar();
// get a reference to the panel bar
var panelBar = $("#panelbar").data("kendoPanelBar");
// remove Item 1
panelBar.remove("#Item1");
</script>
The PanelBar item(s) to be removed, expressed as a selector string, DOM element or a jQuery object.
Gets or sets the selected item.
<ul id="panelbar">
<li id="item1">Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar();
// access an existing PanelBar instance
var panelBar = $("#panelbar").data("kendoPanelBar");
// select the item with ID, "item1"
panelBar.select("#item1");
</script>
The PanelBar item to be selected, expressed as a string containing a selector expression or represented by a jQuery selector.
jQuery
the selected item if called without arguments. kendo.ui.PanelBar
if called with arguments.
Triggered when an item of a PanelBar is activated.
The activated item of the PanelBar.
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
// event handler for activate
var onActivate = function(e) {
// access the activated item via e.item (HTMLElement)
// detach activate event handler via unbind()
panelBar.data("kendoPanelBar").unbind("activate", onActivate);
};
// attach activate event handler during initialization
var panelBar = $("#panelbar").kendoPanelBar({
activate: onActivate
});
</script>
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar();
// event handler for activate
var onActivate = function(e) {
// access the activated item via e.item (HTMLElement)
// detach activate event handler via unbind()
$("#panelbar").data("kendoPanelBar").unbind("activate", onActivate);
};
// attach activate event handler via bind()
$("#panelbar").data("kendoPanelBar").bind("activate", onActivate);
</script>
Triggered when an item of a PanelBar is collapsed.
The collapsing item of the PanelBar.
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
// event handler for collapse
var onCollapse = function(e) {
// access the collapsed item via e.item (HTMLElement)
// detach collapse event handler via unbind()
panelBar.data("kendoPanelBar").unbind("collapse", onCollapse);
};
// attach collapse event handler during initialization
var panelBar = $("#panelbar").kendoPanelBar({
collapse: onCollapse
});
</script>
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar();
// event handler for collapse
var onCollapse = function(e) {
// access the collapsed item via e.item (HTMLElement)
// detach collapse event handler via unbind()
$("#panelbar").data("kendoPanelBar").unbind("collapse", onCollapse);
};
// attach collapse event handler via bind()
$("#panelbar").data("kendoPanelBar").bind("collapse", onCollapse);
</script>
Fires when content is fetched from an AJAX request.
The selected item
The loaded content element
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar({
contentLoad: function(e) {
// handle event
}
});
</script>
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
// get a reference to the panel bar
var panelBar = $("#panelbar").data("kendoPanelBar");
// bind the contentLoad event
panelBar.bind("contentLoad", function(e) {
// handle event
});
</script>
Triggered after the dataSource change event has been processed (adding/removing items);
The node whose children have been changed. If the changes have occurred on the root level, this parameter is undefined.
<div id="panelbar"></div>
<script>
$("#panelbar").kendoPanelBar({
dataSource: [
{ text: "foo", items: [
{ text: "bar" }
] }
],
dataBound: function(e) {
console.log("DataBound", e.node);
}
});
</script>
<div id="panelbar"></div>
<script>
function panelbar_dataBound(e) {
console.log("DataBound", e.node);
}
$("#panelbar").kendoPanelBar({
dataSource: [
{ text: "foo", items: [
{ text: "bar" }
] }
]
});
var panelbar = $("#panelbar").data("kendoPanelBar");
panelbar.bind("dataBound", panelbar_dataBound);
</script>
<div id="panelbar"></div>
<script>
$("#panelbar").kendoPanelBar({
dataSource: [],
dataBound: function(e) {
if (!this.dataSource.data().length) {
this.element.append("<p class='no-items'>No items yet.</p>");
} else {
this.element.find(".no-items").remove();
}
}
});
</script>
Fires when AJAX request results in an error.
This event won't fire if you use jQuery 3.x. More information is available here.
The jqXHR object used to load the content
The returned status.
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar({
error: function(e) {
// handle event
}
});
</script>
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar();
// get a reference to the panel bar
var panelBar = $("#panelbar").data("kendoPanelBar");
// bind the error ajax event
panelBar.bind("error", function(e) {
// handle event
});
</script>
Triggered when an item of a PanelBar is expanded.
The expanding item of the PanelBar.
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
// event handler for expand
var onExpand = function(e) {
// access the expanded item via e.item (HTMLElement)
// detach expand event handler via unbind()
panelBar.data("kendoPanelBar").unbind("expand", onExpand);
};
// attach expand event handler during initialization
var panelBar = $("#panelbar").kendoPanelBar({
expand: onExpand
});
</script>
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar();
// event handler for expand
var onExpand = function(e) {
// access the expanded item via e.item (HTMLElement)
// detach expand event handler via unbind()
$("#panelbar").data("kendoPanelBar").unbind("expand", onExpand);
};
// attach expand event handler via bind()
$("#panelbar").data("kendoPanelBar").bind("expand", onExpand);
</script>
Triggered when an item of a PanelBar is selected by the user.
The selected item of the PanelBar.
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
// event handler for select
var onSelect = function(e) {
// access the selected item via e.item (HTMLElement)
// detach select event handler via unbind()
panelBar.data("kendoPanelBar").unbind("select", onSelect);
};
// attach select event handler during initialization
var panelBar = $("#panelbar").kendoPanelBar({
select: onSelect
}).data("kendoPanelBar");
</script>
<ul id="panelbar">
<li>Item 1
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
<li>Sub Item 3</li>
</ul>
</li>
</ul>
<script>
$("#panelbar").kendoPanelBar();
// event handler for select
var onSelect = function(e) {
// access the selected item via e.item (HTMLElement)
// detach select event handler via unbind()
$("#panelbar").data("kendoPanelBar").unbind("select", onSelect);
};
// attach select event handler via bind()
$("#panelbar").data("kendoPanelBar").bind("select", onSelect);
</script>