strange JS error when recursively adding nodes..

7 posts, 0 answers
  1. PNR
    PNR avatar
    3 posts
    Member since:
    Apr 2006

    Posted 26 Mar 2008 Link to this post

    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
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 27 Mar 2008 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jim
    Jim avatar
    21 posts
    Member since:
    Oct 2007

    Posted 15 Feb 2013 Link to this post

    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).
  5. Bozhidar
    Admin
    Bozhidar avatar
    1103 posts

    Posted 18 Feb 2013 Link to this post

    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.
  6. Jim
    Jim avatar
    21 posts
    Member since:
    Oct 2007

    Posted 19 Feb 2013 Link to this post

    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.
  7. Bozhidar
    Admin
    Bozhidar avatar
    1103 posts

    Posted 20 Feb 2013 Link to this post

    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.
  8. Jim
    Jim avatar
    21 posts
    Member since:
    Oct 2007

    Posted 21 Feb 2013 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017