I have read how you can add a dependent method / calculated field to an ObservableObject (http://docs.kendoui.com/getting-started/framework/mvvm/observableobject), but I cannot find how you can define a dependent method / calculated field in the schema of a Model (http://docs.kendoui.com/api/framework/model). The instances of my Model are read from a remote kendo DataSource, so I need to define a dependent method / calculated field in the schema of the Model so that every instance of my Model automatically has this dependent method / calculated field. I've tried defining it as a field with the defaultValue set to the function and set nullable: true, but all the instances of my Model end up with null values in this field. Here's an example:
so when I get an instance of my Product from my kendo DataSource its CategorySortOrder property is null. So, how to define dependent method / calculated field in model schema?
var Category = kendo.data.Model.define({ id: "Id", fields: { Id: { type: "number", editable: false, nullable: true}, Title: { type: "string" }, SortOrder: { type: "number" } }}var Product = kendo.data.Model.define({ id: "Id", fields: { Id: { type: "number", editable: false, nullable: true}, Title: { type: "string" }, CategoryId: { type: "number" }, Category: {}, CategorySortOrder: { defaultValue: function() { return this.get("Category.SortOrder"); }, nullable: true } }}so when I get an instance of my Product from my kendo DataSource its CategorySortOrder property is null. So, how to define dependent method / calculated field in model schema?