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

Events for connections

6 Answers 128 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Oscar
Top achievements
Rank 1
Oscar asked on 25 Sep 2014, 08:39 AM
Is there any chance to implement some kind of events for connections (eg: change)?

I need to allow to edit a diagram, but I must keep a logic relation where children items can only be attached to elements on the first parent level. Right now there is no event nor an option to do this that I know of.

6 Answers, 1 is accepted

Sort by
0
Hristo Germanov
Telerik team
answered on 28 Sep 2014, 09:19 PM
Hello Oscar,

Currently there are no such event but I would suggest to submit your request in Kendo's UserVoice so other members of the community can evaluate, comment on and vote for it. 

Regards,
Hristo Germanov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Jason
Top achievements
Rank 1
answered on 28 Apr 2015, 02:41 PM

Here is the User Voice post:

 http://kendoui-feedback.telerik.com/forums/127393-telerik-kendo-ui-feedback/suggestions/7694934-diagram-event-for-connection-created

 If I can't find a way around not having connection events, this is probably a deal breaker for us.  

0
Jason
Top achievements
Rank 1
answered on 28 Apr 2015, 03:02 PM

Here's what I'm going to try:

 1.  Detect the connection add event
 2.  Get the shape from the first mouse enter event (this is the shape the connection initiated from)
 3.  Get the next shape from the mouse enter event and make sure it's different from the originating shape.  
 4.  Detect the mouse leave event and then query the connections and check the newly added connection to see if it has a shape in the to property.  

0
Daniel
Telerik team
answered on 30 Apr 2015, 01:33 PM
Hello Jason,

If you are using a diagram bound via a dataSource and a connectionsDataSource then you could use the connectionsDataSource change event. It will be triggered for the from and to fields when a connection is connected to a shape. For a hierarchical dataSource currently I cannot currently suggest any better solution. I am sorry for the inconvenience caused.

Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Jason
Top achievements
Rank 1
answered on 30 Apr 2015, 04:34 PM

Thanks Daniel, it looks like this may work.  I do have a question on how to subscribe to the change event as I'm not setting up the data source like the examples.  I'm using the setConnectionsDataSource method.  

 ex.   $scope.integrationDiagram.setConnectionsDataSource(vm.connections); //vm.connections is an array of from: to: connection objects.  

 

Thank you for your help

0
Daniel
Telerik team
answered on 04 May 2015, 02:29 PM
Hello again Jason,

You could either set a dataSource instance and set the handler in the options:
$scope.integrationDiagram.setConnectionsDataSource(new kendo.data.DataSource({
    data: vm.connections,
    change: changeHandler
}));
or use the bind method after setting the data:
 
$scope.integrationDiagram.setConnectionsDataSource(vm.connections);
$scope.integrationDiagram.connectionsDataSource.bind("change", changeHandler);



Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Diagram
Asked by
Oscar
Top achievements
Rank 1
Answers by
Hristo Germanov
Telerik team
Jason
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or