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

selected nodes count problem

3 Answers 114 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Mario
Top achievements
Rank 2
Mario asked on 28 Nov 2010, 06:48 PM
Hi,
i want to display the number of currently selected nodes of my radTreeView (clientside).

so i have the nodeClicked event working fine.

var tree = $find("<%= radTreeView.ClientID %>");
var nodes = tree.get_selectedNodes();

i get the treeview object. i also got a object from the get_selectedNodes method.

But i cant get the Count fomr this array of nodes.

I tried .Count() .count() and get_count(), always getting an exception, stating that this object does'nt own such a method.

What may be helpfull?

thanks Mario

3 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 29 Nov 2010, 08:03 AM
Hello Mario,


Use nodes.length for getting the count of the nodes.

Client code:
function getSelected() {
    var tree = $find("<%= treeview1.ClientID %>");
    var nodes = tree.get_selectedNodes();
    alert(nodes.length);
}



-Shinu.
0
Daniel
Top achievements
Rank 1
answered on 10 Feb 2016, 10:12 PM

function nodeSelecting(sender, args) {
var nodes = sender.get_selectedNodes();
alert(nodes.length);
}

Where sender is a radtreeview,

It always returns 0, am I missing a property somewhere?

 

Thank You

0
Eyup
Telerik team
answered on 15 Feb 2016, 09:39 AM
Hi Daniel,

Please make sure that the time for executing this logic is appropriate and the nodeSelecting function is not called too. You can check that by temporarily transferring your script logic to a button client-side click handler.

Regards,
Eyup
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
TreeView
Asked by
Mario
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Daniel
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or