vue-jstree
vue-jstree copied to clipboard
Updating 'data' props from parent does not seem to call `.initializeData`
Hi,
I was unable to access functions like openChildren
closeChildren
from my item using the item-click
event. It seems that .initializeData
is only called in created
hook. In my case, I do update data from outside of my component.
It this intended? I tried to used updated
instead of created
but wasn't able to get it work either..
Thanks for your help!
Actually adding a watch
statement onto data
prop fixes that. But maybe you have a better solution.
Can you write example how you fix that?
hi
It worked by calling the initialize method in the child component each time the data was updated.
watch: {
data : function() {
this.$refs.tree.initializeData(this.data);
}
},
this.$refs.tree
'tree' should match the ref attribute name in the component tag.
Although it may not be a fundamental solution, I am pleased if it will be helpful.
Im sorry my English is not good. Thanks.