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.");
});

The names of events are case-insensitive.

Detaching event listeners

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

var onitemclick = tree.events.on("ItemClick", function(id, e){
    console.log("The item with the id "+ id +" was clicked.");
});
 
tree.events.detach(onitemclick);

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.

Back to top