dynamically load child parent data

Issue #11 new
star dart created an issue

Hi, can you add a way to dynamically load child parent data?
id parentId name
1, -1, root
2, 1, name1.1
3, 1, name1.2
4, 3, name1.2.1
5, 3, name1.2.2
6, 3, name1.2.3


Comments (4)

  1. Terje Bergesen

    I think what he is asking for is an example of dynamically loading children of a parent node. Assume, for example, your tree is being used against some REST service. Every time you expand a node, you have to go to that REST service to retrieve the children of the node being expanded. I am using this for a project where the number of nodes in the tree (if I loaded it was all at once) is a little over 175 000 nodes.

    In your examples, the entire tree is defined when it is being created, all nodes in the entire tree are already defined. In my case I get the root level, and dynamically populate the nodes under the root as they are being expanded. I have managed to do this with this Widget, but I am a little skeptical that I (apparently) have to call setState on the entire tree to update the children of the node being expanded, but I haven’t checked the source yet to see if this could become a performance problem.

    I thnk he might be asking for an example showing something like that. Perhaps I am wrong.

  2. Kevin Armstrong

    Terje, I can’t guarantee there will be no performance hits when using that many nodes. Dynamically loading data is certainly possible. I have done that in numerous use cases. It does require updating the state of the entire tree though. So far I’ve had no performance problems using this method.

    I viewed this issue as just trying to convert data in one format into another.

  3. Log in to comment