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

[Solved] How do you get the currently selected item for a tree?

4 Answers 217 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Khurrum Mahmood
Top achievements
Rank 1
Khurrum Mahmood asked on 19 May 2010, 10:14 PM
Hi guys,

Any quick code to find the currently selected tree node?

4 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 20 May 2010, 01:27 PM
Hello Khurrum,

If you want to get the text of the selected node, you can use the following: $('#TreeView .t-state-selected').text(). (TreeView is the name of the treeview).

Regards,
Alex Gyoshev
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
0
Khurrum Mahmood
Top achievements
Rank 1
answered on 20 May 2010, 06:11 PM
Thanks Alex, I was looking for the selected value and I tried the val() method, but it returns an empty value.
0
Alex Gyoshev
Telerik team
answered on 21 May 2010, 08:10 AM
Hello Khurrum,

Getting the value can be achieved using the following JavaScript:

    var treeview = $('#TreeView');
    var selectedItem = treeview.find('.t-state-selected').closest('.t-item');
    treeview.data('tTreeView').getItemValue(selectedItem);


Best wishes,
Alex Gyoshev
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
0
shilpa
Top achievements
Rank 1
answered on 06 Aug 2010, 01:52 PM
Hi,
How can get checked node from treeview?
Tags
TreeView
Asked by
Khurrum Mahmood
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Khurrum Mahmood
Top achievements
Rank 1
shilpa
Top achievements
Rank 1
Share this question
or