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

[Solved] Scrolling to selected Tree View node on Postback

1 Answer 334 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ramjee
Top achievements
Rank 1
Ramjee asked on 17 Mar 2010, 05:13 PM
I have a Treeview inside a RAD Combo. The user selects a node and hits the submit button. I am doing a client-side scrolling using the following code:

root.get_nodes().getNode(j).select();

root.get_nodes().getNode(j).scrollIntoView();

Thios works fine. However, if the selected node is down the scroll area (about 10 items are visible at a time), the node is selected but the cursor does not scroll directly down to the selected node.

Thanks!

Ramjee

1 Answer, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 18 Mar 2010, 03:50 PM
Hi Ramjee,

I've made a sample solution to show you how to scroll into view  a node from a RadTreeView in RadComboBox. Here's the Javascript function:

function OnClientDropDownOpenedHandler(sender, eventArgs) {
            var tree = sender.get_items().getItem(0).findControl("RadTreeView1");
            var selectedNode = tree.get_selectedNode();
            if (selectedNode) {
                selectedNode.scrollIntoView();
            }
        }

In the markup all you have to do is set a Height to the RadTreeView:

<telerik:RadTreeView runat="server" ID="RadTreeView1" Height="140px">

You can find the full code in the attached .zip file.

Please let me know if this was helpful.

Best wishes,
Veronica Milcheva
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
Ramjee
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Share this question
or