Search results

Complex Data Binding in JavaScript (ES5) TreeGrid control

02 Feb 2023 / 1 minute to read

You can achieve complex data binding in the treegrid by using the dot(.) operator in the column.field.

Source
Preview
index.js
Copied to clipboard
var treeGridObj = new ej.treegrid.TreeGrid({
    dataSource: complexData,
    childMapping: 'subtasks',
    height: 315,
    treeColumnIndex: 1,
    columns: [
                { field: 'taskID', headerText: 'Task ID', width: 90, textAlign: 'Right' },
                { field: 'taskName', headerText: 'Task Name', width: 180 },
                { field: 'assignee.firstName', headerText: 'Assignee', width: 90},
                { field: 'duration', headerText: 'Duration', width: 80, textAlign: 'Right' }
    ]
});

treeGridObj.appendTo('#TreeGrid');