Add tree node without reloading all data

3 posts, 0 answers
  1. Виталий
    Виталий avatar
    1 posts
    Member since:
    Jan 2012

    Posted 25 Jan 2012 Link to this post

    TreeView html:
    <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.
  2. James
    James avatar
    8 posts
    Member since:
    Nov 2011

    Posted 17 Apr 2012 Link to this post

    I am also facing the same issue, I am using Kendoui Dropdown list and Tree View, when dropdown list change event occours the treeview data will change but the TreeView style is not applied.

  3. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2527 posts

    Posted 17 Apr 2012 Link to this post

    TreeView nodes can be inserted without reloading all the data by calling one of the append, insertBefore and insertAfter methods.

    Greetings,
    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!
Back to Top