Open veeramarni opened 6 years ago
@fritz-c is it something you can tell us it would work then we will have our developers work on it and probably we would create an example project to add to your readme.
There is an undocumented and untested bit of functionality to load children asynchronously when they are defined as a function instead of an array. Take a look in the react-sortable-tree.js source file to see something about lazy loading to figure out how it works. If it’s buggy, please submit pull requests to fix it if possible. It would be nice to have as an official feature, but it adds in a few gotchas that I didn’t want to consider early in development.
@fritz-c
We have created this PR for lazy loading to work. Please review and let us know.
@fritz-c Any comments or suggestions on the PR?
I have created another PR to include example of lazy-loading nodes and also bug fix.
Actually it was working quite stable, on React 15 for a while, but now it seems that React 16 is a bit harsh about unhadled exceptions, so it was not stable when you do drag and drop over not yet loaded nodes. So in PR I tried to avoid throwing an exeption in some cases and instead handling undefined
result was added.
@fritz-c thanks for the very great component. We want to know how we can load the children's child asynchronously when the
expand
button is clicked.Initially, we want to send the UI just the first depth and as the user clicks on the expansion button we want to pull more data. We sending column
hasChildren
boolean for a placeholder for asynchronous data. So when the expansion is clicked it will pull additional node data from the backend. Let me know what I need to tweak to get there.