Hi,
I have managed to add a shape to my diagram doing the following:
<button onclick="addValueCheck()">Add Value Check</button>
function addValueCheck() {
var shape = new kendo.dataviz.diagram.Shape({
type: "rectangle",
width: 240,
height: 67,
stroke: {
width: 1,
color: "#e8eff7"
},
fill: "#e8eff7",
editable: true
});
var diagram = $("#diagram").getKendoDiagram();
diagram.addShape(shape);
diagram.bringIntoView(diagram.shapes);
}
The shape is added to the diagram visually but when I try and click it I get a Javascript error. I have attached the page I am working on and the javascript error.
5 Answers, 1 is accepted
Hello X,
The problem i caused due to the fact that mixed binding is used. The shapes are loaded using DataSource (shapesDataSource), but the addShape method adds the shape directly to the Diagram. A valid approach should be adding the shape to the data source directly as shown in the http://dojo.telerik.com/upeZo example.
Regards,Boyan Dimitrov
Telerik by Progress
Hello,
In order the shape to be shown immediately the shape should have an unique id and the DataSource should be synced. Please refer to the http://dojo.telerik.com/upeZo/5 example.
Regards,Boyan Dimitrov
Progress Telerik
Thanks for that.
One other thing, is there a way to attach different properties to different shapes when you edit them?
So for instance clicking on the President, would load up with...
1. Name
2. Date of Birth
3. Date became president
And then for Relations Manager for instance you could have....
1. Date became Relations Manager
2. Department
Hello X,
The editable.shapeTemplate can be defined as function in order to implement such functionality. Please refer to http://dojo.telerik.com/UVeDI example. It allows to display different template based on some condition.
Regards,Boyan Dimitrov
Progress Telerik