Skip to main content

Event Handling

Attaching event listeners

You can attach event listeners with the tree.events.on() method:

tree.events.on("itemClick", function(id, e){
console.log("The item with the id "+ id +" was clicked.");
});
note

The names of events are case-insensitive.

Related sample: Tree. Events

Detaching event listeners

To detach events, use tree.events.detach():

tree.events.on("itemClick", function(id, e){
console.log("The item with the id "+ id +" was clicked.");
});

tree.events.detach("itemClick");

Calling events

To call events, use tree.events.fire():

tree.events.fire("name",args);
// where args is an array of arguments

The list of events

The full list of events is available in the related API section.