Trouble with node.scrollIntoView()

2 posts, 0 answers
  1. Peter
    Peter avatar
    17 posts
    Member since:
    Dec 2008

    Posted 02 Dec 2009 Link to this post

    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.
  2. Yana
    Admin
    Yana avatar
    5013 posts

    Posted 04 Dec 2009 Link to this post

    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.
Back to Top