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

Hierarchical treeview with parent and child datasources

Hi Syncfusion,

Would you please help me out with the ejTreeView control?
I'm trying to display a 2-level list of checkbox items with a separate datasource for parents and children.
I cannot get the children to be displayed. What am I doing wrong?


Thank you in advance,
Tomasz Bednarek

3 Replies

KR Karthik Ravichandran Syncfusion Team March 30, 2017 12:09 PM UTC

Hi Tomasz, 
 
Thanks for contacting Syncfusion support. 
 
You can achieve your requirement by processing your dataSource using ej.DataManager. Please refer the below code block. 
 
var therapeuticAreas1 = new ej.DataManager(therapeuticAreas); 
var projects1 = new ej.DataManager(projects); 
 
$("#treeView").ejTreeView({ 
    fields: { 
        dataSource: therapeuticAreas1, id: "id", text: "name", 
        child: { 
            dataSource: projects1, id: "id", parentId: "therapeuticAreaId", text: "name" 
        } 
    }, 
    allowMultiSelection: true, 
    showCheckbox: true, 
    fullRowSelect: true 
}); 
 
 
Based on your requirement we have modified your sample, please refer the below link. 
 
 
Please let us know if you need further assistance on this. 
 
Regards, 
Karthik R 



TB Tomasz Bednarek April 4, 2017 10:52 AM UTC

Hi Karthik,

Thanks, it works. I think it would be a good idea to review and extend the documentation of the control, especially the fields section, because you have no chance of knowing the correct approach by reading the documentation.

Kind Regards,
Tomasz Bednarek


KR Karthik Ravichandran Syncfusion Team April 5, 2017 12:20 PM UTC

Hi Tomasz, 
 
Thanks for your update. 
 
We will consider this as an improvement in our side and we will improve our document in our upcoming releases. 
 
Please let us know if you have any concerns 
 
Regards, 
Karthik R 


Loader.
Up arrow icon