Hi John,
Thanks for contacting Syncfusion support.
We can add child to the Parent when we expanding it using “addRow()” public method. We have slightly changed your code according to this. Please refer below code example for details.
<body> <div class="content-container-fluid"> <div class="row"> <div class="cols-sample-area"> <div id="TreeGridContainer" style="height: 450px; width: 100%;" /> </div> </div> </div>
<script type="text/javascript">
//…
$(function () { $("#TreeGridContainer").ejTreeGrid({ dataSource: data, //… columns: [ { field: "Name", headerText: "Name", editType: "stringedit" } ], expanding: function (args) { // Update children of expanded parent. var rowIndex = args.recordIndex; var children = []; for (var j = 1; j < 10; j++) { var child = { "Name": "Child " + j }; obj = $("#TreeGridContainer").data("ejTreeGrid"); // set the current record as selected Item args.model.selectedRowIndex = args.recordIndex; args.model.selectedItem = args.data;
// add child to the selected item. obj.addRow(child, ej.TreeGrid.RowPosition.Child); children.push(child); } } }); }); </script> </body> |
We have also modified your sample and you can find the sample under the following location.
Sample: http://jsplayground.syncfusion.com/Sync_5beye4c5
Regards,
Mahalakshmi K.
Hi John,
We can also able to reproduce the time delay when using the “addRow()” public method to add child to the parents when they expanded. But at present there is no built in support to add dynamic rows when the parent gets expended. So we have logged a feature report regrading this. A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.
https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents
Please let us know if you require further assistance on this.
Regards,
Mahalakshmi K.