Hi,
I am trying to define a Model for my kendoTreeList.
Normally I would define a Model like:
var Product = kendo.data.Model.define({
id: "ProductID", // Defines the field to be used as the identifier.
fields: {
// Define the fields of the model and their data types.
ProductID: { type: "number" },
ProductName: { type: "string" },
QuantityPerUnit: { type: "string" },
UnitPrice: { type: "number" },
UnitsInStock: { type: "number" },
Discontinued: { type: "boolean" }
}
});
But with the TreeList you normally have to define the Model like this with a parentId:
model: {
id: "EmployeeId",
parentId: "SupervisorId",
fields: {
SupervisorId: { field: "SuperviorId", nullable: true },// this is the parent.
EmployeeId: { field: "EmployeeId", type: "number" },
},
expanded: true
}
I don't think kendo.data.Model.define works for this type of model because it doesnt have some of the properties like parentId or expanded. Is there something I can substitute it with?
What I am trying to do is create a class of Models and I can slide the Model definition in like:
$("#reportsTreeList").kendoTreeList({
dataSource:
{
data: reports,
schema: {
model: Models.TREELISTMODEL
}
},
height: "auto",
OR:
var ds = new kendo.data.DataSource({ data: reportsList, schema: { model: Models.TREELISTMODEL }});
this approach seems to work with a kendo spreadsheet or a grid... but TreeView seems to break.
Thanks again for your help and patience!
George