Get Connection Object

3 posts, 1 answers
  1. David
    David avatar
    2 posts
    Member since:
    May 2015

    Posted 20 May 2015 Link to this post

    Hi, I'm testing the diagram component for my app, I'm porting a desktop app that uses Dataweb's diagramming library.

     How do I retrieve an existing connection object since it does not have an element ID?

     

    This is what I need:

    var connection = diagram.getConnection(params);

    Thanks!

    David

  2. Answer
    Vessy
    Admin
    Vessy avatar
    1389 posts

    Posted 25 May 2015 Link to this post

    Hi David,

    You can access the array containing all connections of a Diagram through the diagram Kendo UI widget like folows:
    $find("RadDiagram1").get_kendoWidget().connections;

    Unfortunately, as the connections do not expose an id property (their ID is automatically generated), the only possible approach I can suggest you in order to differentiate between the different connections is to implement your logic depending on each connection's from- and to- shape. For example:
    function getConnetion() {
        var diagram = $find("RadDiagram1").get_kendoWidget();
        var connections = diagram.connections;
        var conID, fromShape, toShape;
     
        for (var i = 0; i < connections.lenght; i++) {
            fromShape = diagram.connections[i].from;
            toShape = diagram.connections[i].from;
            conID = getConnectionID(fromShape, toShape);
        }
         
    }
    function getConnectionID(fromShape, toShape) {
        var returnValue = "";
     
        if (fromShape == "s1" && toShape == "s2") {
            returnValue = "connection1";
        }
        else if (fromShape == "s2" && toShape == "s3") {
            returnValue = "connection3";
        }
        //etc.
        return returnValue;
    }


    Regards,
    Vessy
    Telerik
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. David
    David avatar
    2 posts
    Member since:
    May 2015

    Posted 25 May 2015 Link to this post

    Thanks Vessy, I did that already.
Back to Top