We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Can't able to retrieve selected nodes in PageLoad

Hi, 
     I was unable to load the selected nodes in tree view control though i saved the selected nodes in separate variable and push it back again. Kindly check and provide with relevant example.

I have attached sample codes for biding and retrieving selected nodes below.

Regards, 
Justin Ebenezer 


Attachment: bug_fbd98e95.zip

1 Reply

CI Christopher Issac Sunder K Syncfusion Team April 3, 2019 12:39 PM UTC

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 


Loader.
Live Chat Icon For mobile
Up arrow icon