I have a very simple listview that I cannot get to show any data.
View:
@(Html.Kendo().ListView<PortalContext.Root>()
.Name("leafView")
.TagName("div")
.ClientTemplateId("leafTemplate")
.DataSource(dataSource => {
dataSource.Model(model => { model.Id(p => p.RootId);
model.Field<string>(f => f.ShortName);
});
dataSource.Read(read => read.Action("Leafs", "Home").Data("branchLevel"));
})
)
<script type="text/x-kendo-tmpl" id="leafTemplate">
<div style="height:100px">
#: ShortName #
</div>
</script>
I have a treeview that refreshes the data onSelect
function onSelect(e) {
if (treeview.dataItem(e.node).IsBranch) {
branchId = treeview.dataItem(e.node).id;
$("#leafView").data("kendoListView").dataSource.read();
}
}
function branchLevel() {
return {
branchId: branchId
};
}
I have simplified a few things but my controller looks like this and is basically returning a list of objects.
public ActionResult Leafs([DataSourceRequest]DataSourceRequest request, int? branchId) {
return Json(ViewModel.Roots.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
Any ideas why this may not be working?
Bill