editable.connectionTemplate String|Function
Specifies the connection editor template which shows up when editing the connection. A template can be used to change the default editors for the connection fields or to prevent some fields from being edited by not rendering an editor input for them.
Example - setting the connectionTemplate
<script id="popup-editor" type="text/x-kendo-template">
<h3>Edit Connection Data</h3>
<p>
<label>From Shape: <input name="from" data-role="dropdownlist" data-bind="value: from" data-source="shapesDataSource" data-text-field="id" data-value-field="id" /></label>
</p>
<p>
<label>To Shape: <input name="to" data-role="dropdownlist" data-bind="value: to" data-source="shapesDataSource" data-text-field="id" data-value-field="id" /></label>
</p>
</script>
<div id="diagram"></div>
<script>
var serviceRoot = "https://demos.telerik.com/kendo-ui/service";
var shapesDataSource = {
batch: false,
transport: {
read: {
url: serviceRoot + "/DiagramShapes",
dataType: "jsonp"
},
update: {
url: serviceRoot + "/DiagramShapes/Update",
dataType: "jsonp"
},
destroy: {
url: serviceRoot + "/DiagramShapes/Destroy",
dataType: "jsonp"
},
create: {
url: serviceRoot + "/DiagramShapes/Create",
dataType: "jsonp"
},
parameterMap: function (options, operation) {
if (operation !== "read") {
return { models: kendo.stringify(options.models || [options]) };
}
}
},
schema: {
model: {
id: "id",
fields: {
id: { from: "Id", type: "number", editable: false },
JobTitle: { type: "string" },
Color: { type: "string" }
}
}
}
};
var connectionsDataSource = {
batch: false,
transport: {
read: {
url: serviceRoot + "/DiagramConnections",
dataType: "jsonp"
},
update: {
url: serviceRoot + "/DiagramConnections/Update",
dataType: "jsonp"
},
destroy: {
url: serviceRoot + "/DiagramConnections/Destroy",
dataType: "jsonp"
},
create: {
url: serviceRoot + "/DiagramConnections/Create",
dataType: "jsonp"
},
parameterMap: function (options, operation) {
if (operation !== "read") {
return { models: kendo.stringify(options.models || [options]) };
}
}
},
schema: {
model: {
id: "id",
fields: {
id: { from: "Id", type: "number", editable: false },
from: { from: "FromShapeId", type: "number" },
to: { from: "ToShapeId", type: "number" },
fromX: { from: "FromPointX", type: "number" },
fromY: { from: "FromPointY", type: "number" },
toX: { from: "ToPointX", type: "number" },
toY: { from: "ToPointY", type: "number" }
}
}
}
};
function onDataBound(e) {
var that = this;
setTimeout(function () {
that.bringIntoView(that.shapes);
}, 0);
}
$("#diagram").kendoDiagram({
layout: {
type: "layered"
},
dataSource: shapesDataSource,
connectionsDataSource: connectionsDataSource,
editable: {
tools: ["edit"],
connectionTemplate: kendo.template($("#popup-editor").html())
},
connectionDefaults: {
editable: {
tools: ["edit"]
}
},
dataBound: onDataBound
});
</script>