ListView not showing template

2 posts, 0 answers
  1. William
    William avatar
    2 posts
    Member since:
    Mar 2014

    Posted 18 Nov 2015 Link to this post

    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

  2. William
    William avatar
    2 posts
    Member since:
    Mar 2014

    Posted 18 Nov 2015 in reply to William Link to this post

    This has been resolved. 
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top