toggle
Fires when the user changes the checked state of a toggle button.
Important
click
event does not fire for buttons that havetogglable: true
Event Data
e.target jQuery
The jQuery object that represents the command element.
e.checked Boolean
Boolean flag that indicates the button state.
e.id String
The id of the command element.
e.item Object
The item instance of the toggled item.
e.sender kendo.ui.ToolBar
The widget instance which fired the event.
Example - subscribe to the "toggle" event during initialization
<div id="toolbar"></div>
<script>
$("#toolbar").kendoToolBar({
items: [
{ type: "button", id: "btn1", text: "Button 1", togglable: true },
{ type: "button", id: "btn2", text: "Button 2", togglable: true }
],
toggle: function(e) {
console.log("toggle", e.target.text(), e.checked);
}
});
</script>
Example - subscribe to the "toggle" event after initialization
<div id="toolbar"></div>
<script>
$("#toolbar").kendoToolBar({
items: [
{ type: "button", id: "btn1", text: "Button 1", togglable: true },
{ type: "button", id: "btn2", text: "Button 2", togglable: true }
]
});
var toolbar = $("#toolbar").data("kendoToolBar");
toolbar.bind("toggle", function(e){
console.log("toggle", e.target.text(), e.checked);
});
</script>