Open kirajhpang opened 7 years ago
Hi @kirajhpang,
sorry for my late response, but maybe it helps?
I did this some days ago with the following logic:
on_user_click
(same as clicking on the expand property)on-click
from the directive to attach my own handlerI hope this helps!
@torsten-sauer hi, thanks for your update however, but I couldn't found out the way to load specific children form server and attach them to that branch ?
It surely depends on your backend and how you load the tree and it's children. You will need at least one function to get the root(s) of the tree and one function to get the children of a specific node.
If you know how to load these it is really simple to attach them. You can set the children
attribute of the clicked branch and expand it.
To clarify: not the tree grid itself loads the nodes, you have to do this on your own and than attach them to the tree. So it really really depends where your tree data comes from and how do you load it.
Actually, before raising this issues, I do create get tree and specific children feature on my backend service, but on that time I cannot find the way to assign this children array into that specific node.
I also remember, even I try to update tree element from angular controller, it seem no refresh the tree, on that time, what I can do for bypassing this is simply re-create the list for refresh it.
However, I will try your suggestion and look back this document if I have time, thanks for reply btw.
If you use the on-click
you get the single node/branch of the tree. You need to set the children
property of the given branch and set the expanded
property to true - that should do the trick. You don't need to update the whole tree data, only the selected/clicked branch.
Hi, I would like to know there is there possible to do dynamic fetch children from REST?
Example, every node will have + button no matter how, but when user click it, it trigger call and refresh this particular children to new array data set.
This will be great for optimizing, so that we can reduce time wait for first time call to initialize tree data.