This is a migrated thread and some comments may be shown as answers.

TreeView With Complex Data

1 Answer 184 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Gaetano
Top achievements
Rank 1
Gaetano asked on 04 Mar 2014, 10:45 AM
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 object...it will occurs only on the root level of the tree.
Each Object A always have a list of object B

ObjectB
        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

ObjectC
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 expandable..so it never call the action with the id param.

What Am I doing wrong?
Thanks
Fabio

1 Answer, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 06 Mar 2014, 09:47 AM
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);

Regards,
Alex Gyoshev
Telerik

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!

Tags
TreeView
Asked by
Gaetano
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Share this question
or