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

Strange Append behavior

1 Answer 70 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 17 Oct 2012, 06:26 PM
I am using the following JavaScript to append a child node to the selected node:

        var nodeText = prompt("Please enter a description", "");
        if (nodeText != null && nodeText != "")
        {
            var treeView = $('#catalogTreeView').data('kendoTreeView');
            var selectedNode = treeView.select();
            treeView.append( { text: nodeText }, $(selectedNode));
        }

The first attempt results in an exception thrown in kendo.web.min.js at:

return this.insert(this._data.length,a) (_data is undefined)

However, if I immediately attempt to add the child node again, it appends without any errors.

The nodes for this TreeView are loaded using an MVC DataSource.  However, I would like my users to be able to append nodes manually.

1 Answer, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 18 Oct 2012, 08:04 AM
Hello Steven,

The same scenario is working in the online TreeView API demo. Please refer to the code used there.

Kind regards,
Alex Gyoshev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
TreeView
Asked by
Steven
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Share this question
or