getShapeByModelUid

Returns the shape corresponding to the model with the specified uid value.

Parameters

uid String

The model uid value.

Returns

kendo.dataviz.diagram.Shape the shape corresponding to the model.

Example - get shape by model uid

<button id="getShapeBtn">Select third shape</button>
<div id="diagram"></div>
<script>
  $("#getShapeBtn").on("click", function(){
    var diagram = $("#diagram").getKendoDiagram();
    var dataItem = diagram.dataSource.at(2);
    var shape = diagram.getShapeByModelUid(dataItem.uid);
    diagram.select(shape);
  });
  var serviceRoot = "https://demos.telerik.com/kendo-ui/service";

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

  var connectionsDataSource = {
    batch: false,
    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"
    },
    dataSource: shapesDataSource,
    connectionsDataSource: connectionsDataSource,
    shapeDefaults: {
      content: {
        template: "#= dataItem.JobTitle #"
      }
    }
  });
</script>
In this article