Hi Ebenezer,
Greetings from Syncfusion!!!
We have prepared sample by saving the selected Nodes in a separate array and push back it to the treeview control afterwards. In the sample, we get the set of nodes from the service and push it to a temp array if the id matches with the dataSource. Please check the following code snippet.
let selectedModels = this.dataService.requestData().selectedTreeNodes;
//compares whether the id present in dataSource and push it to an array if it exists
const selectedArr = [];
for (let j = 0; j < this.field.dataSource.length; j++) {
let id = this.field.dataSource[j]["id"].toString();
if (selectedModels.indexOf(id) !== -1)
selectedArr.push(id);
}
return selectedArr; |
Please check the sample and let us know if we misunderstood your query or need any further assistance.
Thanks,
Christo