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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Can't able to retrieve selected nodes in PageLoad

Thread ID:

Created:

Updated:

Platform:

Replies:

143719 Apr 2,2019 11:51 AM UTC Apr 3,2019 12:39 PM UTC Angular - EJ 2 1
loading
Tags: Treeview
Ebenezer
Asked On April 2, 2019 11:51 AM UTC

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

Christopher Issac Sunder K [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon