connections

Returns the connections attached to the shape. You can optionally specify to return only the incoming or outgoing connections.

Parameters

type String

If not parameter specified all connections are returned, if "in" then only the incoming (i.e. towards the shape) are returned, if "out" the only the outgoing (i.e. away from the shape) are returned.

Example - accessing the connections originating from a given shape

<div id="diagram"></div>
<script>
  var shapesDataSource = {
    data: [
      { id: 1, JobTitle: "Job 1", Color: "red" },
      { id: 2, JobTitle: "Job 2", Color: "blue" },
      { id: 3, JobTitle: "Job 3", Color: "green" }
    ]
  };

  var connectionsDataSource = {
    data: [
      { id: 1, from: 1, to: 2},
      { id: 2, from: 1, to: 3},
    ]
  };

  var diagram = $("#diagram").kendoDiagram({
    dataSource: shapesDataSource,
    connectionsDataSource: connectionsDataSource,
    layout: {
      type: "tree"
    },
    shapeDefaults: {
      content: {
        template: "#= dataItem.JobTitle #"
      }
    }
  }).getKendoDiagram();

  var outConnections = diagram.shapes[0].connections("out");
/* The result can be observed in the DevTools(F12) console of the browser. */
  console.log(outConnections);
</script>
In this article