Non self-referencing On Demand Sample

3 posts, 0 answers
  1. Jesse
    Jesse avatar
    6 posts
    Member since:
    Jan 2008

    Posted 25 Sep 2015 Link to this post

    I am looking for an example that loads a treeview from data that is not self-referencing (no ParentID field) but with specific category levels.  If my data looks like:
    ID   Lastname     Firstname  City       State
    1     Davolio         Nancy          Seattle   WA
    2     Fuller            Andrew        Tacoma  WA
    3     Washington George          Dallas     TX
    4     Leverling      Janet            Kirkland  WA
    5     Peacock       Margaret      Seattle    WA
    6     Doe              Jane             Austin     TX
    7     Doe              John             Dallas     TX

    … I want it to come out like this:
    TX
     └ Austin
              └ Jane Doe
    └ Dallas
              └ George Washington
              └ John Doe
    WA
      └ Kirkland
                └ Janet Leverling
      └ Seattle
                └ Nancy Davolio
                └ Margaret Peacock
       └ Tacoma
                └ Andrew Fuller


    I also would like it to load on demand (JsonResult) as each state and city gets expanded.
    Is there an example on how to build the tree like this?
  2. Jesse
    Jesse avatar
    6 posts
    Member since:
    Jan 2008

    Posted 27 Sep 2015 Link to this post

    I figured out how to load the tree using the TreeViewItemModel in the controller and binding to it in the view, but it loads all nodes at once.  Any clues on how to make each level load on demand?
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 29 Sep 2015 Link to this post

    Hello Jesse,

     

    The loadOnDemand option indicates whether the child DataSources should be fetched lazily when parent groups get expanded. 

     

    When the kendo UI TreeView is bound to remote data source this option is set to true, so the child items are loaded when the parent node is expanded. 

     

    Regards,
    Boyan Dimitrov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top