Hi Weam,
Thanks for contacting Syncfusion support.
In TreeGrid, at present we can add a row using addRow public method. We can add multiple records in TreeGrid by adding new records in existing data source and refreshing the data source of TreeGrid by using setModel method. Please find the code example below.
|
function addData() {
var treeObj = $("#TreeGridContainer").ejTreeGrid("instance");
var data = $.extend([], treeObj.model.dataSource),
parentId = treeObj.model.selectedItem ? treeObj.model.selectedItem.TaskID : 1,
taskId = treeObj.model.flatRecords.length,
subTreedata = [{ "TaskID": ++taskId, "TaskName": "Child Task 1", "StartDate": new Date("02/23/2017"), "EndDate": new Date("02/27/2017"), "Progress": "40", "parentID": parentId },
//..
],
dataSource = $.merge(data, subTreedata);
treeObj.setModel({ "dataSource": dataSource });
} |
We have also prepared the sample for this, please find the sample from below location.
Regards,
Jone sherine P S