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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Treeview nodes collapse after being refreshed

Thread ID:





146727 Aug 16,2019 04:32 AM UTC Nov 13,2020 08:34 AM UTC Vue 3
Tags: Treeview
Adam Moroff
Asked On August 16, 2019 04:32 AM UTC

I have a Treeview control which is populated from a Vuex store via a getter in a computed property.  The problem is when the computed property is fired the treeview is refresh but all the nodes are collapsed.  Ive tried using  the enablePersistence property but it doesnt work.  My code is below.  any help is appreciated.


computed: {
fields() {
return {
id: 'id',
text: 'name',
child: 'pages',
dataSource: this.$store.getters['notebookStore/getNotebook'].sections
notebook() {
return this.$store.getters['notebookStore/getNotebook']


Ashokkumar Balasubramanian [Syncfusion]
Replied On August 19, 2019 11:42 AM UTC

Hi Adam Moroff, 
Good day to you. 
We have validated your requirements and prepared a sample according to that. When the computed property is fired, the overall component will be re rendered. So, if you want to maintain the expanded state, you have to update the state of the corresponding node in the nodeExpanded event using the following code snippet. 
        onExpand(args) { 
            this.$store.dispatch("onExpand", args.nodeData); 
onExpand(state, data) { 
            state.treeDataSource = state.treeDataSource.filter( 
                _ => (_.expanded = data.expanded) 
Kindly check the above sample and let us know if you have any concerns. 
Ashokkumar B. 

Yogesh Patil
Replied On November 12, 2020 05:25 AM UTC

Can I get the same solution in Angular 8.

Shameer Ali Baig Sulaiman Ali Baig [Syncfusion]
Replied On November 13, 2020 08:34 AM UTC

Hi Yogesh, 
In the following Angular TreeView’s documentation section, we have added sample for adding new nodes in the tree node. On adding the tree node, other already expanded tree nodes will stay in expanded state. 
Can you please share us your exact requirement/problem details with EJ2 TreeView. So, we can understand and provide you the prompt solution needed. 
Please, check out the following links to know more about EJ2 TreeView component. 
Please, let us know if you need any further assistance. 
Shameer Ali Baig S. 


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