shapeDefaults.editable Boolean|Object (default: true)

Defines the shape editable options.

shapeDefaults.editable.connect Boolean (default: true)

Specifies if new connections can be added using the shapes connectors.

Example - preventing the user from adding new connections to shapes

<div id="diagram"></div>
<script>
  $("#diagram").kendoDiagram({
    shapeDefaults: {
      editable: {
        connect: false
      }
    },
    shapes: [{
      id: "1",
      content: {
        text: "Monday"
      },
      x: 100,
      y: 20
    }, {
      id: "2",
      content: {
        text: "Tuesday"
      },
      x: 250,
      y: 20
    }, {
      id: "3",
      content: {
        text: "Wednesday"
      },
      x: 250,
      y: 200
    }],
    connections: [{
      from: "1",
      to: "2"
    },{
      from: "2",
      to: "3"
    }],
    connectionDefaults: {
      endCap: "ArrowEnd"
    }
  });
</script>

shapeDefaults.editable.drag Boolean (default: true)

Specifies if the shapes can be dragged.

Example - disabling shapes dragging

<div id="diagram"></div>
<script>
  $("#diagram").kendoDiagram({
    shapeDefaults: {
      editable: {
        drag: false
      }
    },
    shapes: [{
      id: "1",
      content: {
        text: "Monday"
      },
      x: 100,
      y: 20
    }, {
      id: "2",
      content: {
        text: "Tuesday"
      },
      x: 250,
      y: 20
    }, {
      id: "3",
      content: {
        text: "Wednesday"
      },
      x: 250,
      y: 200
    }],
    connections: [{
      from: "1",
      to: "2"
    },{
      from: "2",
      to: "3"
    }],
    connectionDefaults: {
      endCap: "ArrowEnd"
    }
  });
</script>

shapeDefaults.editable.remove Boolean (default: true)

Specifies if the shapes can be removed.

Example - preventing the user from deleting shapes

<div id="diagram"></div>
<script>
  $("#diagram").kendoDiagram({
    shapeDefaults: {
      editable: {
        remove: false
      }
    },
    shapes: [{
      id: "1",
      content: {
        text: "Monday"
      },
      x: 100,
      y: 20
    }, {
      id: "2",
      content: {
        text: "Tuesday"
      },
      x: 250,
      y: 20
    }, {
      id: "3",
      content: {
        text: "Wednesday"
      },
      x: 250,
      y: 200
    }],
    connections: [{
      from: "1",
      to: "2"
    },{
      from: "2",
      to: "3"
    }],
    connectionDefaults: {
      endCap: "ArrowEnd"
    }
  });
</script>

shapeDefaults.editable.tools Array|Boolean

Specifies the toolbar tools. Provides all options that are supported for toolbar.items. If set to false, no edit tools will be displayed.

The predefined tools are:

  • "edit" - The selected item can be edited.
  • "delete" - The selected items can be deleted.
  • "rotateClockwise" - The selected items can be rotated clockwise. The default rotation value is 90 degrees.
  • "rotateAnticlockwise" - The selected items can be rotated anticlockwise. The default rotation value is 90 degrees.

Example - using predefined tools

<div id="diagram"></div>
<script>
  $("#diagram").kendoDiagram({
    shapeDefaults: {
      editable: {
        tools: [{
          name: "delete"
        }, {
          name: "rotateClockwise"
        }, {
          name: "rotateAnticlockwise"
        }]
      }
    },
    shapes: [{
      id: "1",
      content: {
        text: "Monday"
      },
      x: 100,
      y: 20
    }, {
      id: "2",
      content: {
        text: "Tuesday"
      },
      x: 250,
      y: 20
    }, {
      id: "3",
      content: {
        text: "Wednesday"
      },
      x: 250,
      y: 200
    }],
    connections: [{
      from: "1",
      to: "2"
    },{
      from: "2",
      to: "3"
    }],
    connectionDefaults: {
      endCap: "ArrowEnd"
    }
  });
</script>

Example - using custom tools

<div id="diagram"></div>
<script>
  $("#diagram").kendoDiagram({
    shapes: [{}],
    shapeDefaults: {
      editable: {
        tools: [{
          type: "button",
          text: "Set Content",
          click: function() {
            var selected = $("#diagram").getKendoDiagram().select();
            var content = $("#content").val();
            for (var idx = 0; idx < selected.length; idx++) {
              selected[idx].content(content);
            }
          }
        }, {
          template: "<input id='content' class='k-textbox' value='Foo' />"
        }]
      }
    }
  });
</script>

shapeDefaults.editable.tools.name String

The name of the tool. The built-in tools are edit, delete, rotateClockwise, and rotateAnticlockwise.

shapeDefaults.editable.tools.step Number (default: 90)

The step of the rotateClockwise and rotateAnticlockwise tools. It determines the angle at which a selected shape will be rotated when one of the tools is clicked.

Example - changing the shapes rotation step

<div id="diagram"></div>
<script>
  $("#diagram").kendoDiagram({
    layout: "tree",
    shapeDefaults: {
      editable: {
        tools: [{
          name: "delete"
        }, {
          name: "rotateClockwise",
          step: 45
        }, {
          name: "rotateAnticlockwise",
          step: 45
        }]
      }
    },
    shapes: [{
      id: "1",
      content: {
        text: "Monday"
      }
    }, {
      id: "2",
      content: {
        text: "Tuesday"
      }
    }, {
      id: "3",
      content: {
        text: "Wednesday"
      }
    }],
    connections: [{
      from: "1",
      to: "2"
    },{
      from: "2",
      to: "3"
    }],
    connectionDefaults: {
      endCap: "ArrowEnd"
    }
  });
</script>
In this article