schemaObject

The schema configuration of the GanttDataSource.

Example

<script>
var dataSource = new kendo.data.GanttDataSource({
  transport: {
    read: {
      url: "https://demos.telerik.com/service/v2/core/GanttTasks",
      type: "POST",
      contentType: "application/json"
    }
  },
  schema: {
    model: {
      id: "id",
      fields: {
        id: { type: "number" },
        title: { type: "string" },
        start: { type: "date" },
        end: { type: "date" },
        parentId: { type: "number", nullable: true }
      }
    },
    data: "data",
    total: "total"
  }
});
dataSource.fetch(function() {
/* The result can be observed in the DevTools(F12) console of the browser. */
  console.log("Data loaded:", this.data().length + " tasks");
});
</script>

schema.modelObject

The model configuration of the GanttDataSource. See GanttTask for more information.

Note that if the parentId type is number, its defaultValue should be set to null.

Example - configure the data source model schema

<script>
var dataSource = new kendo.data.GanttDataSource({
  transport: {
    read: {
      url: "https://demos.telerik.com/service/v2/core/GanttTasks",
      type: "POST",
      contentType: "application/json"
    },
    update: {
      url: "https://demos.telerik.com/service/v2/core/GanttTasks/Update",
      type: "POST",
      contentType: "application/json"
    },
    destroy: {
      url: "https://demos.telerik.com/service/v2/core/GanttTasks/Destroy",
      type: "POST",
      contentType: "application/json"
    },
    create: {
      url: "https://demos.telerik.com/service/v2/core/GanttTasks/Create",
      type: "POST",
      contentType: "application/json"
    }
  },
  schema: {
    model: {
      id: "id",
      fields: {
        id: { from: "ID", type: "number" },
        orderId: { from: "OrderID", type: "number", validation: { required: true } },
        parentId: { from: "ParentID", type: "number", nullable: true },
        start: { from: "Start", type: "date" },
        end: { from: "End", type: "date" },
        title: { from: "Title", defaultValue: "", type: "string" },
        percentComplete: { from: "PercentComplete", type: "number" },
        summary: { from: "Summary" },
        expanded: { from: "Expanded" }
      }
    }
  }
});
dataSource.fetch(function() {
  var task = this.at(0);
/* The result can be observed in the DevTools(F12) console of the browser. */
  console.log(task.title);
});
</script>
In this article
schemaschema.model
Not finding the help you need?
Contact Support