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

How to populate a Treeview with data from a Vuex store

Hello,
I am trying to populate a Treeview with data from a Vuex store without success.  Does anyone have some sample code on how to do this?   Ive tried dispatching an action in the beforeMount() function to populate the vuex store and then using a computed variable populate the Treeview, but it doesnt seem work even though the Treeview control has the fields.datasource variable populated with my data.  

Any sample code on how to do this would be greatly appreciated.

Kind Regards
Adam      

3 Replies

MR Mohan Ravi Syncfusion Team August 12, 2019 10:37 AM UTC

Hi Adam, 

From analyzing your query and as you said Treeview datasource is filled with store data. I think the problem here might be in field property mapping. Treeview fields id, text child and other properties should be also mapped correctly. 

I have prepared a sample to populate Treeview using Vuex. 


Please refer the sample, if you have any further doubts please feel free to contact us. 

Regards, 
Mohan 



AM Adam Moroff August 13, 2019 07:29 AM UTC

Thanks Mohan, it works perfectly. 


AB Ashokkumar Balasubramanian Syncfusion Team August 13, 2019 07:33 AM UTC

Hi Adam, 
 
We are glad to hear that the provided solution worked for you. Please let us know, if you need any further assistance. 
 
Regards, 
Ashokkumar B. 


Loader.
Live Chat Icon For mobile
Up arrow icon