diagram.model.drawType = {
type: "connector",
segments: [{ type: "straight" }]
};
diagram.update({
tool: ej.datavisualization.Diagram.Tool.DrawOnce
});
connectorCollectionChange: function (args) {
let diagram = $("#Diagram").ejDiagram("instance");
if (args.state == "changed" && args.element.name.includes("connector")) {
if (args.element.sourceNode && args.element.targetNode) {
let node = diagram.findNode(args.element.targetNode);
diagram.updateConnector(args.element.name, {
constraints: ej.datavisualization.Diagram.ConnectorConstraints.Default & ~ej.datavisualization.Diagram.ConnectorConstraints.Select
});
}
else {
let connector = diagram.findNode(args.element.name);
diagram.remove(connector);
// Allow user to draw ONE connector
diagram.model.drawType = {
type: "connector",
segments: [{ type: "straight" }]
};
diagram.update({
tool: ej.datavisualization.Diagram.Tool.DrawOnce
});
}
}
},
|
function CollectionChange(args) {
if (args.state === 'changing') {
args.cancel = true;
console.log("Hit");
}
} |
|
function CollectionChange(args) {
if (args.state === 'changing' && (args.element.sourceNode === null || args.element.targetNode === null)) {
args.cancel = true;
console.log("Hit");
}
} |