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

Cannot get parent node text

3 Answers 144 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Chanchal
Top achievements
Rank 1
Chanchal asked on 18 Jul 2014, 11:52 AM
Hi, 

I have a Kendo tree view with three levels. Please see the attached file MyTree.jpg.

I have a leaf node's with text value "CHINA".  I am not able to get the leaf node's parent node text. Please see the attached file ChromeOutput.jpg. 

Please advise why undefined is returned for below -

treeview.text(treeview.parent(treeview.findByText("CHINA")))

Regards, 
Manoj



3 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 18 Jul 2014, 01:46 PM
Hello Manoj,

I tried reproducing this problem in the following Dojo snippet, to no avail. Can you please adjust it so that it shows the problem?

Regards,
Alex Gyoshev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Chanchal
Top achievements
Rank 1
answered on 19 Jul 2014, 01:54 AM
Hi Alex, 

Thanks. 

The problem is not simulating in the Dojo or Chrome console using the Dojo code. I am using razor view and C# to generate the tree. I am also attaching my tree view definition.

Can you please advise any other way to get the parent node's text ?

Regards,
Manoj 












0
Accepted
Alex Gyoshev
Telerik team
answered on 21 Jul 2014, 07:59 AM
Hello Chanchal,

Remove the DataTextField line and the problem will be resolved.

The problem in this scenario is that the DataTextField instructs the text method that the text is stored in the "Text" field. This can be true if the tree was loaded via AJAX; however, the TreeView is rendered from the server, so the datasource uses the default, lowercase-t "text" field. So, the text method returns undefined.

Working sample is attached.

Regards,
Alex Gyoshev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

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