TreeView html:
Initializing treeview:
I need append new tree node to existing tree with my attributes.
<ul id="ouTreeview"> <li data-expanded="true" data-ouid="0" data-isexternal="false" data-parentid="0"> <label>Root Element</label> </li></ul>Initializing treeview:
<script language="javascript" type="text/javascript"> var ouTreeview; var selectedOUId; var selectedOUName; var ouTreeviewNode; var selectedParentId; var selectedOUIsExternal; function setSelectedTitleById(id) { selectedOUName = $(".ouLeftCol:first").find("#ouTreeview:first").find("li[data-ouid='" + id +"']:first").find("label:first").text(); } $(document).ready(function () { function onSelect(e) { ouTreeviewNode = e.node; selectedParentId = $(e.node).data("parentid"); selectedOUIsExternal = ($(e.node).data("isexternal").toString().toLowerCase() ==='true'); selectedOUId = $(e.node).data("ouid"); setSelectedTitleById(selectedOUId); $.ajax({ url: "@Url.Action("LoadOUForm", "DashBoard")", type: "POST", cache: false, success: function (response) { $(".ouRightCol").html(response); if (selectedOUId != "ROOT") { $("table.ouForm").find("input[id='ouTitle']").val(selectedOUName); if (selectedOUIsExternal) { $("table.ouForm").find("input[id='ouIsExternal']").attr("checked","checked"); } else { $("table.ouForm").find("input[id='ouIsExternal']").removeAttr("checked"); } } } }); } ouTreeview = $("#ouTreeview").kendoTreeView({ select: onSelect }); });I need append new tree node to existing tree with my attributes.