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

RadTreeView - Load on Demand and select correct node

3 Answers 206 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Brian Meagher
Top achievements
Rank 1
Brian Meagher asked on 29 Jul 2010, 03:19 PM
I have a RadTreeView control that is configured to Load on Demand (client side). Specifically, the TreeNodeExpandMode is "ServerSideCallBack".

I would like to be able to select the selected node upon the loading of the page. I have this working fine with a TreeView that is "fully loaded" (meaning all of the nodes are pre-loaded), but the page is very large because of the size of the treeview.

I could not find an example showing how to load only the root nodes + the nodes that need to be loaded in order to make this work. Any suggestions would be appreciated!

3 Answers, 1 is accepted

Sort by
0
Nikolay Tsenkov
Telerik team
answered on 02 Aug 2010, 07:27 PM
Hi Brian Meagher,

Could you, please specify, what is exactly that you mean by "select the selected node upon the loading of a page"? Thanks!
Once we clarify the requirements, I am sure we will find a way to achieve them in no time!
 

Regards,
Nikolay Tsenkov
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
Brian Meagher
Top achievements
Rank 1
answered on 03 Aug 2010, 11:31 PM
I struggled with that wording. Let's see if this helps:

I have a treeview with many nodes, sub-nodes and so on. At any given point, the user has a specific node selected ("Grandchild2" in the example below). When the page loads (given that I know the node that is "selected" or "should be open"), I would like to automatically open to that node.

I.E. if "Grandchild2" were the selected node when the page loads, the following treeview should come up:
Root1
Root2
Root3 --> Child1 --> Grandchild2
Root4

Keep in mind that it is in "ServerSideCallBack" mode. My struggle is knowing what nodes to load, and how to present that data to the treeview on load without giving it the whole tree (2,000 nodes).

Does that explanation help?

Thanks!
0
Nikolay Tsenkov
Telerik team
answered on 09 Aug 2010, 12:11 PM
Hello Brian Meagher,

I think I understand your struggle here.
Correct me if I am wrong, but you have TreeView with ExpandMode ServerSideCallBack to all of the nodes in the TreeView, and these nodes can navigate or postback on NodeClick event and present some data according to the selected (in this case clicked) node. When the page is being loaded you want to expand the roots of the clicked node and to select this same node, but the problem is that you don't actually have the node on the client, yet, because the treeView is being loaded from scratch and it's entirely collapsed (maybe you place it in a master page?).

If that is the case, then my advice for you is to place the TreeView inside a MasterPage and display the data associated with the nodes in the content place-holder. Obviously you have a way to persist the data about the selected node, therefore you don't need advice on this one. What is left is how to expand the parents of the currently selected node and to reselect it again - you probably will have to do it on the server - get the persisted information about the selected node (and to persist not only the node but also the parents) and expand the tree accordingly.

Probably my advice seems a bit abstract, but in order to be more concrete, you need to provide me with a sample project recreating the setup just for the treeView (there is no need to send the entire project you work on) so I can prepare an example on how to do that for you.
If you want to go for example from us, please open a support ticket and send us the mentioned above project.

Hope this is helpful for you and that we soon we'll solve your problem!


Regards,
Nikolay Tsenkov
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
Tags
TreeView
Asked by
Brian Meagher
Top achievements
Rank 1
Answers by
Nikolay Tsenkov
Telerik team
Brian Meagher
Top achievements
Rank 1
Share this question
or