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

Expending Node Client side

3 Answers 72 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Igor
Top achievements
Rank 1
Igor asked on 11 May 2011, 01:16 AM

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.

3 Answers, 1 is accepted

Sort by
0
Ivan Zhekov
Telerik team
answered on 12 May 2011, 04:54 PM
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.

0
Igor
Top achievements
Rank 1
answered on 13 May 2011, 06:01 PM
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);
                        }
                    }
                }
            }
        }
    }
}

0
Accepted
Ivan Zhekov
Telerik team
answered on 16 May 2011, 08:54 AM
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.

Tags
TreeView
Asked by
Igor
Top achievements
Rank 1
Answers by
Ivan Zhekov
Telerik team
Igor
Top achievements
Rank 1
Share this question
or