select
Fired when the user selects one or more items.
Event Data
e.selected Array
The selected items (shapes and connections).
e.deselected Array
The rest of the items (shapes and connections).
e.sender kendo.dataviz.ui.Diagram
The widget instance which fired the event.
Example - get shape info from selection
<div id="diagram"></div>
<script>
function onSelect(e){
var selectedItem = e.selected[0]; // first element in selection
if(selectedItem instanceof kendo.dataviz.diagram.Shape){
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log("Selected shape with text: " + selectedItem.options.content.text);
}
}
$("#diagram").kendoDiagram({
shapes:[
{
id:"1",
content:{
text: "State 1"
},
x: 20,
y: 20
},
{
id:"2",
content: {
text: "State 2"
},
x: 160,
y: 20
}
],
connections:[
{
from: "1",
to: "2"
}
],
select: onSelect
});
</script>