getConnectionByModelId
Returns the connection corresponding to the model with the specified id value.
Parameters
id String|Number
The model id value.
Returns
kendo.dataviz.diagram.Connection
the connection corresponding to the model.
Exampmle - get connection information by id
<button id="getConnBtn">Get connection with id = 1</button>
<div id="diagram"></div>
<script>
$("#getConnBtn").on("click", function(){
var diagram = $("#diagram").getKendoDiagram();
var conn = diagram.getConnectionByModelId(1);
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log("Connection between shapes " + conn.from + " and " + conn.to);
});
var serviceRoot = "https://demos.telerik.com/kendo-ui/service";
var shapesDataSource = {
batch: false,
transport: {
read: {
url: serviceRoot + "/DiagramShapes",
dataType: "jsonp"
}
},
schema: {
model: {
id: "id",
fields: {
id: { from: "Id", type: "number", editable: false }
}
}
}
};
var connectionsDataSource = {
batch: false,
transport: {
read: {
url: serviceRoot + "/DiagramConnections",
dataType: "jsonp"
}
},
schema: {
model: {
id: "id",
fields: {
id: { from: "Id", type: "number", editable: false },
from: { from: "FromShapeId", type: "number" },
to: { from: "ToShapeId", type: "number" }
}
}
}
};
$("#diagram").kendoDiagram({
layout: {
type: "layered"
},
dataSource: shapesDataSource,
connectionsDataSource: connectionsDataSource,
shapeDefaults: {
content: {
template: "#= dataItem.JobTitle #"
}
}
});
</script>