parentId(default: "{ type: 'number', nullable: true }")

The name of the Model's parentId field. The Kendo UI OrgChart distinguishes the root items based on the parentId field. If the schema.model.fields.[parentIdField] is nullable, root items with be items whose parentId field values are null. If the schema.model.fields.[parentIdField] is not nullable, root items will be items which have a default value for their data type.

Example

<div id="orgchart"></div>
<script>
var dataSource = new kendo.data.OrgChartDataSource({
    data: [
        { id: 1, name: "CEO", parentId: null },        // Root item (null parentId)
        { id: 2, name: "CTO", parentId: 1 },           // Child of CEO
        { id: 3, name: "CFO", parentId: 1 },           // Child of CEO
        { id: 4, name: "Developer", parentId: 2 },     // Child of CTO
        { id: 5, name: "Designer", parentId: 2 }       // Child of CTO
    ],
    schema: {
        model: {
            id: "id",
            parentId: "parentId",
            fields: {
                id: { type: "number" },
                parentId: { type: "number", nullable: true },
                name: { type: "string" }
            }
        }
    }
});

$("#orgchart").kendoOrgChart({
    dataSource: dataSource
});

dataSource.read().then(function() {
    var rootItem = dataSource.at(0);
    /* The result can be observed in the DevTools(F12) console of the browser. */
    console.log("Root item parentId:", rootItem.parentId); // null
    
    var childItem = dataSource.at(1);
    console.log("Child item parentId:", childItem.parentId); // 1
});
</script>
In this article
parentId
Not finding the help you need?
Contact Support