attaches a handler to an inner event of Diagram

void on(string name,function handler, [any context] );


namestringthe event's name, case-insensitive
handlerfunctionthe handler function
contextanythe value will be accessible as "this" inside of the event handler


diagram.events.on("ShapeClick", function(id) {
    alert("You've just clicked an item with id="+id);

Related samples


See the list of Diagram events.

You can attach several handlers to the same event and all of them will be executed. If some of handlers return false, the related operations will be blocked. Event handlers are processed in the same order that they are attached.

See also
  • API
  • Articles
  • Back to top