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

[Solved] clientside refresh of root node

3 Answers 233 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 2
Markus asked on 26 Mar 2008, 02:14 PM
Hello everybody!

I have a radtreeview with loadondemand (Serversidecallback).

I have implemented a javascript method that refreshed a node:
function RefreshNode(nodeId2Refresh) 
        { 
            var treeView = $find('<%= radpanel.Items[0].Items[0].FindControl("rree").ClientID%>'); 
            var node = treeView.findNodeByValue(nodeId2Refresh).get_parent(); 
             
            treeView.trackChanges(); 
            node.get_nodes().clear(); 
            node.set_expanded(false);             
            treeView.commitChanges(); 
             
            node.set_expandMode(Telerik.Web.UI.TreeNodeExpandMode.ServerSideCallBack); 
            node.expand(); 
        } 

How can I refresh the root nodes this way??
any suggestions?
of course the root element have no parent!

Thx in advance & kind regards

3 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 27 Mar 2008, 09:17 AM
Hi Markus,

I tried the approach you described and it worked as expected at our side. The NodeExpand event was fired upon clicking the "refresh" button.
Attached, please find a small and running project on the matter. Download it and give it a go.

Am I missing something?

Kind regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Markus
Top achievements
Rank 2
answered on 27 Mar 2008, 09:29 AM
Hello Nick!
thx for your answer,

The problem is, that if i select a root node, and I click "refresh", the Javascript compiler says that it cannot find a parent for this node, of course.

I fear that i need a special javascript method for the rootnodes that removes the nodes and loads them afterwards with the same logic when the page loads...



0
Nikolay
Telerik team
answered on 27 Mar 2008, 10:44 AM
Hi Markus,

You can remove the root node at the client-side from the nodes collection of the treeview itself (treeView.get_nodes().remove(node);). However, you will not be able to access any database or other server logic from the client-side to replicate the server's page_load logic on the client.

Regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
TreeView
Asked by
Markus
Top achievements
Rank 2
Answers by
Nikolay
Telerik team
Markus
Top achievements
Rank 2
Share this question
or