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

Trouble with node.scrollIntoView()

1 Answer 77 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 02 Dec 2009, 10:29 AM
Hey Telerik!

The Version of the Telerik.Web.UI.dll I use is: 2008.03.1314.20

I am selecting a TreeNode like so:

function OpenTreeToSpecificNodeRecursion() {  
            var tree = $find('<%= rpbOperational.Items[0].Items[0].FindControl("rtGeographic").ClientID %>');  
            if (aIds2Node.length == 0) {  
                return;  
            }  
            if (tree.findNodeByValue(aIds2Node[0]) != null) {  
                nodeTree = tree.findNodeByValue(aIds2Node.shift());  
 
                if (aIds2Node.length == 0) {  
                    tree.unselectAllNodes();  
                    nodeTree.select();  
                    window.setTimeout(function() { nodeTree.scrollIntoView(); }, 400);  
                    return;  
                }  
                nodeTree.expand();  
            }  
            window.setTimeout("OpenTreeToSpecificNodeRecursion()", 10);  
        } 

If I put an alert(nodeTree.scrollIntoView()) in front of the functioncall the browser tells me "undefined" meaning the function is not defined. Any clue why this should happen?

I realize the tree scrolls and selects the node at the same time, but it should be able to utilize the scrollIntoView() function as this method is called on the Timeout and therefore later?

Thanks for any advice on this. Sincerely, Peter.

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 04 Dec 2009, 03:11 PM
Hi Peter,

You should expand all the parent nodes in order to use scrollIntoView method. I've attached a simple page demonstrating this.

Also alert(nodeTree.scrollIntoView()) return "undefined", because the method doesn't return any value, not that the function is undefined.

Kind regards,
Yana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
TreeView
Asked by
Peter
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or