saveEdit

Saves any changes made by the user.

Example - save modified value on DataSource change

<div id="diagram"></div>
<script>
  var serviceRoot = "https://demos.telerik.com/kendo-ui/service";

  var shapesDataSource = {
    batch: false,
    transport: {
      read: {
        url: serviceRoot + "/DiagramShapes",
        dataType: "jsonp"
      },
      update: {
        url: serviceRoot + "/DiagramShapes/Update",
        dataType: "jsonp"
      },
      destroy: {
        url: serviceRoot + "/DiagramShapes/Destroy",
        dataType: "jsonp"
      },
      create: {
        url: serviceRoot + "/DiagramShapes/Create",
        dataType: "jsonp"
      },
      parameterMap: function (options, operation) {
        if (operation !== "read") {
          return { models: kendo.stringify(options.models || [options]) };
        }
      }
    },
    schema: {
      model: {
        id: "id",
        fields: {
          id: { from: "Id", type: "number", editable: false },
          JobTitle: { type: "string" },
          Color: { type: "string", editable: false }
        }
      }
    },
    change: function(e){
      var item = e.items[0];
      if(e.action=="itemchange" && item[e.field] != ""){
        $("#diagram").getKendoDiagram().saveEdit();
      }
    }
  };

  var connectionsDataSource = {
    batch: false,
    transport: {
      read: {
        url: serviceRoot + "/DiagramConnections",
        dataType: "jsonp"
      },
      update: {
        url: serviceRoot + "/DiagramConnections/Update",
        dataType: "jsonp"
      },
      destroy: {
        url: serviceRoot + "/DiagramConnections/Destroy",
        dataType: "jsonp"
      },
      create: {
        url: serviceRoot + "/DiagramConnections/Create",
        dataType: "jsonp"
      },
      parameterMap: function (options, operation) {
        if (operation !== "read") {
          return { models: kendo.stringify(options.models || [options]) };
        }
      }
    },
    schema: {
      model: {
        id: "id",
        fields: {
          id: { from: "Id", type: "number", editable: false },
          from: { from: "FromShapeId", type: "number" },
          to: { from: "ToShapeId", type: "number" },
          fromX: { from: "FromPointX", type: "number" },
          fromY: { from: "FromPointY", type: "number" },
          toX: { from: "ToPointX", type: "number" },
          toY: { from: "ToPointY", type: "number" }
        }
      }
    }
  };

  $("#diagram").kendoDiagram({
    layout: {
      type: "layered"
    },
    dataSource: shapesDataSource,
    connectionsDataSource: connectionsDataSource,
    editable: {
      tools: ["edit"]
    },
    connectionDefaults: {
      editable: {
        tools: ["edit"]
      }
    },
    shapeDefaults: {
      content: {
        template: "#= dataItem.JobTitle #"
      }
    }
  });
</script>
In this article
Not finding the help you need? Improve this article