TreeView With Complex Data

2 posts, 0 answers
  1. Alberto
    Alberto avatar
    71 posts
    Member since:
    May 2012

    Posted 04 Mar 2014 Link to this post

    Hi Guys, 
    I'm trying to insert a treeview in my application so i checked your online examples..

    My scenario would fall into "Binding to a remote data" but it's a little more complex.

    I have 3 different objects that I need to put in my tree (they came from EF and they are not linked automatically - ef and oracle doesn't work with FK on unic constraints):

    Object A
    public int ID { get; set; }
            public long CLASSID { get; set; }
            public string NAME { get; set; }
            public virtual IEnumerable<ObjectB> DataGroups { set; get; }

    ObjectA is the main-level will occurs only on the root level of the tree.
    Each Object A always have a list of object B

            public int ID { get; set; }
            public long CLASSID { get; set; }
            public string NAME { get; set; }
            public long PARENTID { get; set; }
    public virtual IEnumerable<ObjectC> DataClasses {set;get;}

    each ObjectB always have a list of object C

    public decimal ID { get; set; }
            public string NAME { get; set; }
            public long PARENTID { get; set; }
            public long CLASSID { get; set; }

    Here's a tricky part...
    Each objectC may have a list of objectC...

    now..In your example the read method of the tree call always the same action and whether or not has a parameter load a different node.

    In my case I have different object...Is there a way to Implement your example in my scenario?
    I guess that, if there's not, I'll have to load all root-nodes and with js load every node's children on click.
    I already tried this one and my tree doesn't have to icon to expand a node. I also tried adding to objecta a bool property (like HasChild) and also to fullfill the child list in the first call.
    Same appens if I try to replicate your example..I load the root-level but no node is it never call the action with the id param.

    What Am I doing wrong?

  2. Alex Gyoshev
    Alex Gyoshev avatar
    2500 posts

    Posted 06 Mar 2014 Link to this post

    Hello Fabio,

    At present time, you cannot configure this binding through the MVC wrapper. We are aware of this limitation and will strive to allow this in the near future. Until this happens, you can create a client-side object of the HieararchicalDataSource as described here, and provide it to the TreeView once it is initialized: $("#treeview").data("kendoTreeView").setDataSource(dataSource);

    Alex Gyoshev

    DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!

  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top