setConnectionsDataSource

Sets the connections data source of the diagram.

Parameters

dataSource kendo.data.DataSource

The data source to which the widget should be bound.

Example - set Diagram DataSources dynamically

<button id="dsBtn">Set dataSource</button>
<button id="connDsBtn">Set connectionDataSource</button>
<div id="diagram"></div>
<script>
  $("#dsBtn").on("click", function(){
    var diagram = $("#diagram").getKendoDiagram();
    diagram.setDataSource(shapesDataSource);
  });
  $("#connDsBtn").on("click", function(){
    var diagram = $("#diagram").getKendoDiagram();
    diagram.setConnectionsDataSource(connectionsDataSource);
  });
  var serviceRoot = "https://demos.telerik.com/kendo-ui/service";

  var shapesDataSource = {
    transport: {
      read: {
        url: serviceRoot + "/DiagramShapes",
        dataType: "jsonp"
      }
    },
    schema: {
      model: {
        id: "id",
        fields: {
          id: { from: "Id", type: "number", editable: false }
        }
      }
    }
  };

  var connectionsDataSource = {
    transport: {
      read: {
        url: serviceRoot + "/DiagramConnections",
        dataType: "jsonp"
      }
    },
    schema: {
      model: {
        id: "id",
        fields: {
          id: { from: "Id", type: "number", editable: false },
          from: { from: "FromShapeId", type: "number" },
          to: { from: "ToShapeId", type: "number" }
        }
      }
    }
  };

  $("#diagram").kendoDiagram({
    layout: {
      type: "layered"
    }
  });
</script>
In this article