amsik / liquor-tree

Tree component based on Vue.js
MIT License
398 stars 95 forks source link

Refresh data collapse all nodes #219

Open kelu95 opened 4 years ago

kelu95 commented 4 years ago

Hi,

first, thank you for your work, very helpful!

I have a problem, when I refresh my tree data like this : this.$refs.tree.tree.setModel(newData); The data is well refreshing but all the expanded nodes collapse and I can't find the solution.

Is there a workaround?

Regards

Braedennz commented 3 years ago

+1, i'm also having this issue when using Vuex and the state is changed. All nodes collapse.

Braedennz commented 3 years ago

I found a solution to this, hope it helps:

Simply, use the events node:expanded and node:collapsed to set the node or the VueX store node using node['state'] = { expanded: Boolean}.

This way when the data refreshes, it'll use the most recent toggled state.

apydevs commented 3 years ago

I found a solution to this, hope it helps:

Simply, use the events node:expanded and node:collapsed to set the node or the VueX store node using node['state'] = { expanded: Boolean}.

This way when the data refreshes, it'll use the most recent toggled state.

@Braedennz hey, could you give an example of where you are applying the node.state with Vuex. I'm having the same issue