Expending Node Client side

4 posts, 1 answers
  1. Igor
    Igor avatar
    12 posts
    Member since:
    Dec 2010

    Posted 10 May 2011 Link to this post

    I'm using JavaScript to expand a tree node based on the condition. Script work in IE and FF but not in Chrome, the version of my Chrome browser is 11.


    function ClientNodeExpanded(sender, eventArgs) {
        var node = eventArgs.get_node();
     
        if (typeof (node) !== 'undefined' && node != null) {
            if (node.get_nodes().get_count() > 0) {
                for (var i = 0; i <= node.get_nodes().get_count(); i++) {
                    var ChildNode = node.get_nodes().getNode(i);
                    if (typeof (ChildNode) !== 'undefined' && ChildNode != null) {
                        if (ChildNode.get_text() == "Online") {
                            ChildNode.expand(true);
                        }
                    }
                }
            }
        }
    }

    Can you tell me if this is a problem with the control or i'm doing something wrong?

    Thanks you.
  2. Ivan Zhekov
    Admin
    Ivan Zhekov avatar
    651 posts

    Posted 12 May 2011 Link to this post

    Hello Igor,

    The snippet looks fine, so we'll need a sample project with the menu and snippet included.

    Regards,
    Ivan Zhekov
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. Igor
    Igor avatar
    12 posts
    Member since:
    Dec 2010

    Posted 13 May 2011 Link to this post

    I found the problem, in Chrome for some reason the ChildNode.get_text() is returning an empty string.
    So i had to do a work around just for chrome browser. Here is my updated function.

    function ClientNodeExpanded(sender, eventArgs) {
        var node = eventArgs.get_node();
     
        if (typeof (node) !== 'undefined' && node != null) {
            if (node.get_nodes().get_count() > 0) {
                for (var i = 0; i <= node.get_nodes().get_count(); i++) {
                    var ChildNode = node.get_nodes().getNode(i);
                    if (typeof (ChildNode) !== 'undefined' && ChildNode != null) {
                        var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
                        if (is_chrome) {
                            if (ChildNode.get_textElement().textContent == "Online") {
                                ChildNode.expand(true);
                            }
                        }
                        else {
                            if (ChildNode.get_text() == "Online") {
                                ChildNode.expand(true);
                            }
                        }
                    }
                }
            }
        }
    }

  4. Answer
    Ivan Zhekov
    Admin
    Ivan Zhekov avatar
    651 posts

    Posted 16 May 2011 Link to this post

    Hello Igor,

    The behaviour you described is not correct. We have logged this issue in our bug tracking system to investigate it.

    Thank you for your involvement with Telerik Rad Controls and as a token of our appreciation, we have updated your Telerik Points.

    Best wishes,
    Ivan Zhekov
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top