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

Event names are case-insensitive.

Related sample: Tree. Events

Detaching event listeners​

The tree.events.detach() method removes an event handler:

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

tree.events.detach("itemClick");

Calling events​

The tree.events.fire() method calls an event:

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

List of events​

You can find the full list of Tree events in the API section.