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

Get_Selected: Object doesn't support this property or method

2 Answers 84 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Paul Mc
Top achievements
Rank 1
Paul Mc asked on 10 Jul 2009, 01:19 PM
Hi

We have a radwindow with a rad toolbar across the top and a rad treeview underneath.  In a seperate javascript file, I'm trying to find out which treeview node is currently selected when a button on the toolbar is clicked.  I have stored the Client ID of the treeview as an attribute of the menu and im using the Ajax $find method to locate the treeview object.  The treeview appears to be being found correctly but when i call the get_selected method im getting an object not supported error message.  Is there something obvious im misisng?

Below is a cut down version of the code I have in my Javascript file:

function ToolbarItemClicked(sender, eventArgs) {  
 
    var toolbar = eventArgs.get_item().get_toolBar();  
    var toolbarItem = eventArgs.get_item();  
 
    var ctrlID = toolbar.get_attributes().getAttribute("TreeViewID");  
 
    var treeview = $find(ctrlID);  
    var node = treeview.get_selected();  
 
}

For your information we using the Q2 2009 build.

Thanks in advance.

Paul

2 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 10 Jul 2009, 01:29 PM
Hello Paul Mc,

RadTreeView does note expose such a method. I guess you need to obtain the selected node. To do this please use get_selectedNode():

var node = treeview.get_selectedNode();

Kind regards,
Albert
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Paul Mc
Top achievements
Rank 1
answered on 10 Jul 2009, 01:51 PM
*Banging head on wall* How stupid do I feel now!

Thank Albert, i was looking at the wrong place in the documentation...

i.e.  node.get_selected rather than tree.get_selectednode()
Tags
TreeView
Asked by
Paul Mc
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Paul Mc
Top achievements
Rank 1
Share this question
or