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

strange JS error when recursively adding nodes..

6 Answers 82 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
PNR
Top achievements
Rank 1
PNR asked on 26 Mar 2008, 01:01 PM
Hi everyone!

Im getting some strange errors when trying to "clone" a TreeNode being dragged from 1 treeview to another in Clientside code.

my code apparently works fine, but when expanding the newly created nodes it gives me this error:

"Microsoft JScript runtime error: Sys.ArgumentNullException: Value cannot be null.
Parameter name: handler"

function Sys$EventHandlerList$addHandler(id, handler) {  
        /// <summary locid="M:J#Sys.EventHandlerList.addHandler" /> 
        /// <param name="id" type="String"></param> 
        /// <param name="handler" type="Function"></param> 
        var e = Function._validateParams(arguments, [  
            {name: "id", type: String},  
            {name: "handler", type: Function}  
        ]);  
        if (e) throw e;  
        Array.add(this._getEvent(id, true), handler); 

in the second last line (2854 if it says anything)

Anyone seen this before ?

Kind Regards
Kenneth Christensen

6 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 27 Mar 2008, 11:12 AM
Hi Kenneth,

We have not seen this error before. Could you please send us the code which causes the problem? You can open a formal support ticket and attach us a sample project. Thanks.

Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jim
Top achievements
Rank 1
answered on 15 Feb 2013, 09:18 PM
Any updates to this one?  I'm building a tree on the client side with code like this: (FinishTreeLoad is called from a success handler for an ajax request that returns a json representation of the tree.)

function FinishTreeLoad(response)
{
    var jsTree = jQuery.parseJSON(response.d);
    GetTree().get_nodes().add(ProcessNode(jsTree[0]));
    parent.showloadingtree(false);
    parent.showloadingtoolbar(false);
}
 
function ProcessNode(node)
{
    var dynamicNode = new Telerik.Web.UI.RadTreeNode();
    dynamicNode._loadFromDictionary(node);
    for (child in node.Children)
    {
        dynamicNode.get_nodes().add(ProcessNode(node.Children[child]));
    }
    return dynamicNode;
}

Here's an example of the json used:

[
    {
        "Children": [
            {
                "Children": [
                    {
                        "Children": [
                            {
                                "Children": [
                                    {
                                        "Children": [],
                                        "Text": "Claim Supervisor",
                                        "Value": "CLM"
                                    }
                                ],
                                "Text": "Steven",
                                "Value": "CLM"
                            },
                            {
                                "Children": [
                                    {
                                        "Children": [],
                                        "Text": "Claim Handler(Primary)",
                                        "Value": "CLM"
                                    }
                                ],
                                "Text": "Curtis",
                                "Value": "CLM"
                            }
                        ],
                        "Text": "Party(s) Involved",
                        "Value": "CLM15784"
                    }
                ],
                "Text": "Claim",
                "Value": "CLM"
            }
        ],
        "Text": "Event",
        "Value": "EVT"
    }
]

I get the same error when expanding the claim node (no issue expanding event).
0
Bozhidar
Telerik team
answered on 18 Feb 2013, 11:11 AM
Hello Jim,

I tried to reproduce the issue on my end but to no avail. I'm attaching the sample page I used for testing. Could you try it on your end and confirm that the error occurs. Also, could you specify the version of the controls you are using, as the issue might be caused by a bug that's already been fixed.
 

All the best,
Bozhidar
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Jim
Top achievements
Rank 1
answered on 19 Feb 2013, 02:46 PM
It wouldn't surprise me if this issue is already fixed.  I'm currently working with the 2008.02.0723.20 version, which we currently have a customer live on.  The upgrade to a newer version is in progress (in production with another customer, being retrofitted to this one), but I'm wondering if there's any way to get this fix incorporated with this version in the mean time.  Let me know if I need to open up a support ticket to get further assistance.
0
Bozhidar
Telerik team
answered on 20 Feb 2013, 02:25 PM
Hi Jim,

I've tried the sample page I sent you in my previous post and was able to reproduce the issue. To workaround it you have to add the following code to the page containing the TreeView:
Telerik.Web.UI.RadTreeNode.prototype._shouldInitializeChild = function (childNode) {
    return true;
}

Please note that it's not our usual practice to provide workarounds to bug that we've already fixed, and that we highly recommend always upgrading to the latest version.
 

Kind regards,
Bozhidar
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Jim
Top achievements
Rank 1
answered on 21 Feb 2013, 07:24 PM
Your workaround worked perfectly, thanks!

This will fortunately only be a stop-gap solution, as we only have one customer on this older version, and they're on the upgrade path right now.
Tags
TreeView
Asked by
PNR
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Jim
Top achievements
Rank 1
Bozhidar
Telerik team
Share this question
or