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

What tag for the server response and what adaptor to use?

Thread ID:

Created:

Updated:

Platform:

Replies:

143651 Mar 29,2019 10:02 PM UTC Apr 2,2019 11:34 AM UTC Vue 3
loading
Tags: Treeview
Chris
Asked On March 30, 2019 01:11 AM UTC

Hello,

how do I use the the remote data source properly?
If I use your example data (xml) from
https://js.syncfusion.com/demos/ejServices/Wcf/Northwind.svc

it works. But I have a json source which returns sth like this:

{"id":'root',"parent_id":0,"name":"Root","subChild":[
{"id":1,"parent_id":0,"name":"Test Folder","subChild":[
{"id":2,"parent_id":1,"name":"Child 1"},
{"id":3,"parent_id":1,"name":"Child 2","subChild":[
{"id":4,"parent_id":3,"name":"Child 3"}
]
}
]
},
{"id":5,"parent_id":0,"name":"User 2 Folder 1"},
{"id":6,"parent_id":0,"name":"User 2 Folder 2"}]
}

Do I have to wrap the response in a specific tag, if so what tag? Which Adaptor do I use? I thought that I should use the UrlAdaptor?
It should only be a single request on initialization. Everything else should be handled on the client side.


I wasn't able to find any helpful information in the docs.

Thanks in advance



Christopher Issac Sunder K [Syncfusion]
Replied On April 1, 2019 12:49 PM UTC

Hi Christopher, 

Greetings from Syncfusion!!! 

Your requirement can be achieved by using EJ2 DataManger. We have utilized the “mounted” life cycle event to bind the data from the service. 

mounted() { 
    this.getData(); 
}, 
methods: { 
    async getData() { 
        const data = await new DataManager({ 
            url: SERVICE_URL 
        }).executeQuery(new Query()); 
        this.fields = { 
            id: "id", 
            text: "name", 
            child: "subChild", 
            dataSource: data.result.defaultData 
        }; 
    } 
} 


Please let us know if you have any concerns. 

Thanks, 
Christo 


Chris
Replied On April 1, 2019 02:04 PM UTC

Hello Christopher Issac Sunder K,

thanks for the code, was able to solve the problem! :)

Best

Christopher Issac Sunder K [Syncfusion]
Replied On April 2, 2019 11:34 AM UTC

Hi Christopher, 

We are glad to hear that the issue has been resolved at your end. Please let us know if you require 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