shapeIconClick
Description
Fires on clicking a toolbar icon
Usage
shapeIconClick: (
id: string | number,
event: MouseEvent
) => void;
Parameters
The callback of the event takes the following parameters:
id
- (required) the id of the iconevent
- (required) a native HTML event object
Example
// initializing Diagram
const diagram = new dhx.Diagram("diagram_container", {
toolbar: [
{
id: "download",
content: "<i className='dxi dxi-download'></i>"
},
{
id: "info",
content: "<i className='dxi dxi-information-outline'></i>"
}
]
});
// loading data
diagram.data.parse(data);
// attaching a handler to the event
diagram.events.on("shapeIconClick", function(icon){
const id = diagram.selection.getId();
alert(icon + " was clicked for id = " + id);
});
Related article: Event handling
Related sample: Diagram. Configuration. Per-shape toolbar