When adding a data source to a TreeList using the HTML helper method Html.Kendo().TreeList<...>().DataSource(....) there is no possibility to define the data type that should be used. The data source accepts the JSON data generated by my API, but any updates are submitted using form data, The same problem appears when defining a standalone data source using the helper method Html.Kendo().DataSource<...>().TreeList(....). It is possible to change the TreeList(...) configuration to a Custom(...) configuration, however it is not possible to define the parent identifier of the model in this case.
Html.Kendo().DataSource<MyViewModel>()
.Name("datasource")
.TreeList(source =>
{
source.Batch(true);
source.ServerOperation(false);
source.Model(model =>
{
model.Id(x => x.Id);
model.ParentId(x => x.Parent);
model.Expanded(x => x.Expanded);
});
source.Read("Read", "Api");
// No way to use JSON here
source.Create(ajax => ajax.Action("Write", "Api").Type(HttpVerbs.Post));
source.Update(ajax => ajax.Action("Write", "Api").Type(HttpVerbs.Put));
source.Destroy(ajax => ajax.Action("Write", "Api").Type(HttpVerbs.Delete));
})