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

Javascript error on Collapse of TreeView after clearing Nodes

1 Answer 95 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 28 Aug 2017, 10:35 PM

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?

1 Answer, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 01 Sep 2017, 10:11 AM
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.
Tags
TreeView
Asked by
Jay
Top achievements
Rank 1
Answers by
Peter Milchev
Telerik team
Share this question
or