there is to code a web application and the most important element is the q-tree. I’m already able to load and show data (passing an array called list), but that all nodes are expanded.
The vue.js examples of the official documentation show that you’re be able to do this with the ‘default-expand-all’ attribute but this isn’t working for me.
It only shows me the root node with an arrow, where there is to expand the children nodes manually.
The default-expand-all is only applied on the first rendering of that Component.
So if the Component renders when the nodes aren’t assigned they wont expand if assigned afterwards.
You have to work with scoped slots and an expanded attribute if you dont have the nodes on first rendering.
Solved my problem as following:
there is added a ref attribute to the QTree DOM Element which makes it possible to access predefined methods of QTree API.
The method there is been using is expandAll().
The most important thing for me was, I had to find out which lifecycle hook was the right one for me. The update() hook was the one I was looking for.
Called after a data change causes the virtual DOM to be re-rendered and
The components DOM will have been updated when this hook is called, so you
can perform DOM-dependent operations here.