select

Gets or sets the selected elements.

Example - select a shape

<button id="selectBtn">Select 3rd Shape</button> - adds the shape to the existing selection
<div id="diagram"></div>
<script>
  $("#selectBtn").on("click", function(){
    var diagram = $("#diagram").getKendoDiagram();
    diagram.select(diagram.shapes[2], {addToSelection: true});
  });
  $("#diagram").kendoDiagram({
    shapes:[
      {
        id:"1",
        content:{
          text: "State 1"
        },
        x: 20,
        y: 20
      },
      {
        id:"2",
        content: {
          text: "State 2"
        },
        x: 160,
        y: 20
      },
      {
        id:"3",
        content: {
          text: "State 3"
        },
        x: 160,
        y: 160
      }
    ],
    connections:[
      {
        from: "1",
        to: "2"
      },{
        from: "2",
        to: "3"
      }
    ]
  });
</script>

Parameters

elements kendo.dataviz.diagram.Connection|kendo.dataviz.diagram.Shape|Array

The diagram element(s) that should be selected.

options Object
options.addToSelection Boolean

If set to true the newly selected items will be added to the existing selection. Otherwise a new selection set is created. The default is false.

Returns

Array The selected diagram elements.

Example - select a shape

<div id="diagram"></div>
<script>
  $("#diagram").kendoDiagram({
    shapes: [{
      id: "1"
    }]
  });
  var diagram = $("#diagram").getKendoDiagram();
  diagram.select(diagram.shapes[0]);
</script>
In this article