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

treeview Search on Node Level

3 Answers 173 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Grace Manasseh
Top achievements
Rank 1
Grace Manasseh asked on 20 May 2010, 11:05 AM
hello guys ,


I'm using a RadTreeView with Load On Demand. The ExpandMode property is set to “ServerSideCallBack”. I am trying to implement a search functionality for the tree, whereby I choose the node I want to search in, and filter for certain childnodes. When the search button is clicked, an async call is made to the serverside to fetch the new nodes. The missing part is dealing with the issue on the client side. I would like to see the resulting nodes only. How can I make the button cause a client-side event  similar to the one caused by the click on the ‘+’ sign of the node? So that I can update the childnodes on the client side as well?

3 Answers, 1 is accepted

Sort by
0
Nikolay Tsenkov
Telerik team
answered on 24 May 2010, 05:15 PM
Hi Grace Manasseh,

If the tree is persisted the same on both sides client and server (as it should be), then, the question is only how to trap a client side click event over the button which starts the search?
There is no need to be exactly like NodeExpand and you can access the entire tree as opposed in ServerSideCallback which is light-weight callback and by that reason is a limited one.

You can trap the OnClientClick event over the button. If it's a regular asp:Button then the code is similar to:
<asp:Button runat="server" ID="Button1" OnClientClick="onClientClickHandler" />
And in the handler you can iterate through TreeView's nodes and perform the needed operations.

Hope this is going to help you!


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
Grace Manasseh
Top achievements
Rank 1
answered on 03 Jun 2010, 02:42 PM
Hi,

OnClientClick will raise a client side event but I need to query the search on the database so that's y i need the LoadOnDemand function that renders only the Node clicked and not the whole tree.

I think if i can have the javascript function called when node is clicked i can use it on search click to render only the part of the node needed without rendering all the tree nodes.

Any help would be appreciated...

Thanks,
0
Nikolay Tsenkov
Telerik team
answered on 08 Jun 2010, 11:24 AM
Hello Grace Manasseh,

Here is a good solution, which not only suits your requirements, but also removes the unnecessary overhead - I recommend you do everything server-side:
   - When the button is pressed, a postback is triggered;
  - You check the criteria and add all resulting nodes to the tree's structure.
If you don't want to postback the entire page, then place the treeview and the button in an AjaxPanel.

I think this is the best solution for your case.

Hope this is going to help you!


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
Grace Manasseh
Top achievements
Rank 1
Answers by
Nikolay Tsenkov
Telerik team
Grace Manasseh
Top achievements
Rank 1
Share this question
or