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

Add dataItem to a new shape being added to the diagram

0 Answers 83 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Michelle
Top achievements
Rank 1
Michelle asked on 25 Sep 2015, 05:02 PM

Hi,

I am adding a Shape via a drag and drop function. I am looking to also add a default dataItem to the options of this Shape.

 

$("#diagram").kendoDropTarget({
    drop: function (e) {
        var item, pos, transformed;
        if (e.draggable.hint) {
            item = e.draggable.hint.data("shape");
            pos = e.draggable.hintOffset;
            pos = new Point(pos.left, pos.top);
            transformed = diagram.documentToModel(pos);
            item.x = transformed.x;
            item.y = transformed.y;
 
            //Want to add default dataItem or find a better place to add.
            diagram.addShape(item);
        }
    }
});

 

Here is what my current dataItem look like from other shapes added by Read method. Attached Item.

I want to be able to add this data item like the diagram would normally do but through a drag and drop action. So it can be saved back to the database.

 

Thanks

 

 

 

No answers yet. Maybe you can help?

Tags
Diagram
Asked by
Michelle
Top achievements
Rank 1
Share this question
or