Events for connections

7 posts, 0 answers
  1. Oscar
    Oscar avatar
    173 posts
    Member since:
    Oct 2010

    Posted 25 Sep 2014 Link to this post

    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.
  2. Hristo Germanov
    Admin
    Hristo Germanov avatar
    703 posts

    Posted 28 Sep 2014 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Jason
    Jason avatar
    3 posts
    Member since:
    Jan 2014

    Posted 28 Apr 2015 Link to this post

    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.  

  5. Jason
    Jason avatar
    3 posts
    Member since:
    Jan 2014

    Posted 28 Apr 2015 Link to this post

    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.  

  6. Daniel
    Admin
    Daniel avatar
    2118 posts

    Posted 30 Apr 2015 Link to this post

    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!
     
  7. Jason
    Jason avatar
    3 posts
    Member since:
    Jan 2014

    Posted 30 Apr 2015 in reply to Daniel Link to this post

    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

  8. Daniel
    Admin
    Daniel avatar
    2118 posts

    Posted 04 May 2015 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready