Comments (3)
On second thought, I think it should be possible within react-vtree as is: e.g. I could start fetching data when node is expanded, then once it’s finished update my structure with newly received child node data and run recomputeTree()
with refresh. Going to see if that would allow for good UX.
from react-vtree.
Hi @strogonoff, sorry for long delay.
According to the react-vtree
idea, all the data changes should be done outside of the tree component. After the data fetching is over, you have to update the treeWalker
function (if you use hooks, it is possible with useCallback
with your data variable as deps
), and the tree traversing will be done again building the tree with the new data. To start the data fetching simply add the fetching function to the each node withing the treeWalker
and call it in the Node
component.
I'm going to prepare an example for it, so it may be more descriptive. I'll publish it here as well.
from react-vtree.
Understood. That’s the idea I arrived at in the end: when node is expanded, start data query somewhere else and pass isLoading
to node component in meantime, then once data is fetched remove isLoading
, update tree structure with new data, and recomputeTree
.
If I finish this component I’m building with react-vtree soon enough, I’ll try to contribute an example as well…
from react-vtree.
Related Issues (20)
- React VTree example is not working HOT 1
- how to close all nodes HOT 2
- Returning undefined from treeWalker throws error HOT 2
- Filtering of nodes HOT 1
- scroll to item as a prop HOT 2
- [help] async example HOT 1
- treeWalker is walking all nodes HOT 4
- Changing async tree shape re-opens nested items HOT 1
- Bump React version to 17
- children type NodeComponentType not exposed for consumption HOT 1
- Are there plans to release 3.0.0 soon? HOT 2
- I didn't find any where in the readme about sorting & filter feature ? HOT 1
- Expose row index to Node renderer HOT 3
- [v3.0.0-beta.3] (Safari) ReferenceError: Can't find variable: requestIdleCallback HOT 1
- Build fails with Typescript version v4.4 HOT 1
- The expanded children nodes are expanded even when we collapsed at the parent level. HOT 1
- Collapse specific row HOT 1
- How to update tree after dynamically modifying nodes height? HOT 1
- Setting component state onClick causes the tree to lose focus position during keyboard navigation and go to top of the rendered tree HOT 2
- Show/hide leaf nodes by outer prop HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-vtree.