Event handling
To handle events of Ribbon and its TreeCollection, use the methods of the events module.
Attaching event handlers
You can add any handler to the events of Ribbon and its TreeCollection. To do this, use the ribbon.events.on() method with the following parameters:
evName | name of the event |
evHandler | user-defined event handler |
ribbon.events.on("click", function(id,e){
console.log(id,e);
});
Several handlers can be attached to one and the same event, and all of them will be executed.
note
The names of the events are case-insensitive.
Related sample: Ribbon. Events
Detaching event handlers
There is a simple way of removing an event-handler. Call the ribbon.events.detach() method:
ribbon.events.on("click", function(id,e){
console.log(id,e);
});
ribbon.events.detach("click");
Calling events
You do not need to call events of Ribbon and its TreeCollection. Yet, you can call any custom event with the fire() method of the events module:
ribbon.events.fire(evName,[parameters]);
List of supported events
You can find the full list of Ribbon events in the related API section.