This is a migrated thread and some comments may be shown as answers.

Edit dynamically added shapes

5 Answers 307 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
X
Top achievements
Rank 1
X asked on 19 May 2017, 10:45 AM

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

Sort by
0
Boyan Dimitrov
Telerik team
answered on 23 May 2017, 11:47 AM

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
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
X
Top achievements
Rank 1
answered on 25 May 2017, 12:05 PM
This dojo doesnt work. No shape is added to the page.
0
Boyan Dimitrov
Telerik team
answered on 29 May 2017, 08:25 AM

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
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
X
Top achievements
Rank 1
answered on 13 Jun 2017, 01:04 PM

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

0
Boyan Dimitrov
Telerik team
answered on 15 Jun 2017, 07:08 AM

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
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Diagram
Asked by
X
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
X
Top achievements
Rank 1
Share this question
or