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

Client Side Select() Next Node

1 Answer 64 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Rory
Top achievements
Rank 1
Rory asked on 13 Feb 2008, 10:15 PM
Hey guys my application is using the radtreeview for updating and saving form entry information. So when you select a node it loads a form. You click save and the node is removed in my client side script. 

What would be nice is some way to select the next node after that top one is removed. Or just select the top node like Select(node[0]) or something like this. 

Can you point me in the direction for finding and selecting the next node client side? Is there some way to determine from the Selected Node that i'm about to remove what is the next node and if there is not a next node Select the parent? thank you very much.

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 15 Feb 2008, 03:51 PM
Hello Rory,

You can use the get_nextNode(), get_previousNode() and get_parent() methods.

Consider the following sample code:

<telerik:RadTreeView ID="RadTreeView1"  
            runat="server"  
            LoadingStatusPosition="BeforeNodeText" 
            OnClientNodeClicked="onClick"

<script type="text/javascript"
var nextNode; 
 
function onClick(sender, eventArgs) 
    var node = eventArgs.get_node(); 
    if (node.get_nextNode() != null
    { 
        nextNode = node.get_nextNode(); 
    } 
    else nextNode = node.get_parent(); 
     
    if (nextNode != null && nextNode != node.get_treeView()) 
    { 
        window.setTimeout(function() {nextNode.select()}, 100); 
    } 
     
    node.get_parent().get_nodes().remove(node); 
     
</script> 

I hope this will get you started.

Kind regards,
Veskoni
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
TreeView
Asked by
Rory
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Share this question
or