I noticed that the TreeView widget is behaving totally different when using BindTo(myViewModel.GroupList) versus using DataSource(<calling an action on a controller>). The problem: when using DataSource all additional fields like "Expanded" or "HtmlAttributes" are ignored by the TreeView widget so the TreeView looks different depending on which way I use it.
myViewModel.GroupList is a List<TreeViewItemModel>, the action on my Controller returns a JsonResult(List<TreeViewItemModel>,...). In fact both are exactly the same lists.
The code for DataSource is as follows:
.DataTextField(
"Text"
)
.DataSource(ds => ds
.Read(read => read.Url(SettingsManager.BaseServiceUrl +
"/groups/all/"
).Type(HttpVerbs.Get))
.Model(model =>
{
model.Id(
"Id"
);
model.Children(
"Items"
);
model.HasChildren(
"HasChildren"
);
})
)
Any idea why this happens?
Regards
Heiko