connected
Returns whether the two given shapes are connected through a connection.
Parameters
source Object
A Shape in the diagram.
target Object
A Shape in the diagram.
Example - check if two shapes are connected
<button id="checkConnBtn">Check connection between shapes 2 and 3</button>
<div id="diagram"></div>
<script>
$("#checkConnBtn").on("click", function(){
var diagram = $("#diagram").getKendoDiagram();
var shapes = diagram.shapes;
if(shapes.length >= 3){
var state = diagram.connected(shapes[1], shapes[2]) ? "connected" : "disconnected";
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log("Shapes 2 and 3 are " + state);
}
});
$("#diagram").kendoDiagram({
shapes:[
{
id:"1",
content:{
text: "State 1"
},
x: 20,
y: 20
},
{
id:"2",
content: {
text: "State 2"
},
x: 160,
y: 20
},
{
id:"3",
content: {
text: "State 3"
},
x: 300,
y: 20
}
],
connections:[
{
from: "1",
to: "2"
},
{
from: "2",
to: "3"
}
]
});
</script>