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

TreeView + Hierarchical Data Source - unable to bind the "dataTextField"

0 Answers 179 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Sandeep
Top achievements
Rank 1
Sandeep asked on 26 Jul 2012, 11:03 AM
Hi,

I am accessing an OData service to bind a hierarchical data source to a treeview.  Its a homogenous source - i.e service returns same type each time - type being a "Product" object. Basically its a treeview of products - one product being the parent of many others and so on.

The trouble is that when the tree view renders, its showing me the correct number of items in the tree - say, for example, if there are 2 products , it shows 2 nodes correctly but the name is shown as "undefined".

This is despite specifying the correct field name in the "dataTextField" for this object while creating the treeview.

I examined my datasource in chrome debugger and saw that it returns two objects as below 

{b.extends.f, b.extends.f} 

^^ these are the two records (2 products) from my OData service call.
within each object i.e within each of this {b.extends f} , I have a "Product" object and I want to bind the "Name" property of this Product object to the TreeView Nodes. Accordingly, I have mentioned the "dataTextField" as "Name" but I am unable to see this displayed correctly in the treeview. 

What I have observed is that , I am unable to bind any property of the "Product" object in my datasource. But I can bind any other property which is one level above, or NOT within Product node level- 

ex : if the B.extends F contains -

--Product
--uid:'12121212'
-XXX
--stc:'4543543'

etc

I can bind anything inside XXX (say XXX.Name) or Product . But I can mention "dataTextField: 'uid'  " and it will bind 12121212 correctly in tree view.

So looks like I am unable to navigate one level deeper and bind the product name.

I have already tried "children.Name", "Product.Name" etc in the dataTextField property to no avail.  I have attached some screenshots. Please help.

Please help.







No answers yet. Maybe you can help?

Tags
TreeView
Asked by
Sandeep
Top achievements
Rank 1
Share this question
or