Don't display folder if it has no children

2 posts, 0 answers
  1. Tim
    Tim avatar
    4 posts
    Member since:
    Sep 2008

    Posted 18 Feb 2014 Link to this post

    Hi, Is this possible?
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 20 Feb 2014 Link to this post

    Hello Tim,

    It is possible, you can create a boolean field as part of your ViewModel which is set to false if there are no children. And you can then configure your TreeView model to use that field for the HasChildren option.

    e.g.

    @(Html.Kendo()
            .TreeView()
            .Name("tv")
            .DataSource(ds=>ds.Model(m=>
                m.HasChildren("theNameOfTheField")))
    )


    Kind Regards,
    Petur Subev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top