TreeView with Self Referencing Hierarchy

2 posts, 0 answers
  1. Joey
    Joey avatar
    4 posts
    Member since:
    Aug 2016

    Posted 07 Sep Link to this post

    I'm trying to set up a TreeView. My json data from the server has IDs and Parent IDs that contain what the hierarchy is. Root levels have parentId of "NULL". Can I not specify my hierarchy self-referentially like this? Do I HAVE to make an "items: []" sub-structure in my JSON for each parent node?

     

    var ds = new kendo.data.HierarchicalDataSource({
                transport: {
                    read: function(e) {
                        //JSON is returned here. Example [{id: 50, parentId: "NULL", name: "abc"}, {id: 51, parentId: 50, name: "xyz"}]
                    }
                },
                schema: {
                    model: {
                        id: "id",
                        parentId: "parentId",
                        fields: {
                            id: { type: "number" },
                            parentId: { type: "number", defaultValue: 0 }
                        }
                    }
                }
            });

     

  2. Dimiter Topalov
    Admin
    Dimiter Topalov avatar
    349 posts

    Posted 10 Sep Link to this post

    Hi Joey,

    Please find the answer to this, and your other related question, in the following forum topic:

    http://www.telerik.com/forums/treeview-not-displaying-intended-hierarchy-from-self-referencing-data-source#BYFsSGu5qUSjpT6SqYO0pw

    Regards,
    Dimiter Topalov
    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
  3. Kendo UI is VS 2017 Ready
Back to Top