Javascript error on Collapse of TreeView after clearing Nodes

2 posts, 0 answers
  1. Jay
    Jay avatar
    89 posts
    Member since:
    Nov 2007

    Posted 28 Aug 2017 Link to this post

    We are noticing Telerik client-side (Javascript) code referencing a NULL object after clearing the Nodes in a TreeView control on the client side.

    With the following sample file, we can see the error after expanding, then collapsing the root node:

    <%@ Page Language="C#" AutoEventWireup="true" Inherits="System.Web.UI.Page" %>
     
    <script runat="server">
        void Page_Load(object sender, EventArgs e)
        {
            var node = new RadTreeNode("1");
            node.ExpandMode = TreeNodeExpandMode.ServerSideCallBack;
            node.Nodes.Add(new RadTreeNode("2"));
            TV.Nodes.Add(node);
        }
    </script>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head>
    <title>Telerik TreeView Test</title>
    </head>
     
    <body>
     
    <form id="DialogForm" runat="server">
        <telerik:RadScriptManager ID="SM" runat="server" />
        <telerik:RadTreeView ID="TV" runat="server" OnClientNodeCollapsed="collapse" />
    </form>
     
    <script type="text/javascript">
        function collapse(sender, args) {
            var node = args.get_node();
            sender.trackChanges();
            node.get_nodes().clear();
            sender.commitChanges();
        }
    </script>
     
    </body>
    </html>

     

    Can we accomplish clearing the nodes with error by setting a value somewhere, or do we need to wait for a patch to fix this issue?

  2. Peter Milchev
    Admin
    Peter Milchev avatar
    467 posts

    Posted 01 Sep 2017 Link to this post

    Hello Jay,

    We have tested the provided code in the attached sample project and we observed the correct behavior of the TreeView with no JavaScript errors as demonstrated in this screencast

    Would you please modify the attached project so that it replicates the issue and send it back to us in an official support ticket for further investigation? Once we have any closure, we can share the result here for convenience and better visibility from the community. 

    To run the attached project, the .NET 4.5 version of the Telerik assemblies should be placed in the Bin folder. The version used for recording the screencast is 2017.2.711.45.

    Regards,
    Peter Milchev
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top