Closed swframe closed 9 months ago
Hi @swframe, Sorry for reaching to you directly, but I was wondering if you've managed to find a solution to this issue? We're also looking to lazy load list of files within folders and hoped there is an example here before we scratch heads ourselves.
I wrote a temporary solution but it repaints the tree when the nodes open/close. I store the nodes that are opened and when that Set changes I completely rebuild the tree. I only load the children if the node is in the 'opened' set. I cache the children so once they are loaded, they are not reloaded until the cache expires. I add a fake child to each node that is closed so the UI will draw '>' to let the user know the node is not a leaf.
This is really hacky but it allows me to work on other features. I will continue to work on it to implement a more efficient way to open and close without needing to rebuild the entire tree widget. It shouldn't be too hard.
Thanks, we've addressed some of these issues and provided lazy load example: https://github.com/embraceitmobile/animated_tree_view/compare/main...tomekit:animated_tree_view:main#diff-2f45cb6453ada31c3ecd0f5cc5e11dedac8361c32f724278a9ccb4b749dbd435
There shouldn't be need to add fake child items or repaint tree.
I am not sure what else might come up at this stage, but with these changes we're happy to integrate it within our project.
Thanks! I will try it out.
I'm looking for a behavior similar to the java swing JTree. I want to build a tree model that allows the tree data to be loaded only when it is needed. My app's data is stored in a database and it is not practical to load it all into memory to build all the nodes up front. I suspect I can implement this but I'm curious since all the example code shows cases where the tree is loaded into memory.