-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to update nodes
after onChange
#5
Comments
As a workaround, I'm cleaning the tree, and re-render it from the onChange. Wondering if there's a better way. |
Hi! Yeah, I think re-rendering the tree is the most straight forward way to do it. You can provide a |
Is there an example to that? |
Sure, you can find it in all examples on the demo page. The import { nodes } from './nodes';
import SortableTree from 'sortable-tree';
new SortableTree({
nodes,
element: document.getElementById('tree'),
stateId: 'tree-state',
}); |
I've created a demo repo using IHP (Haskell), so thanks for this handy package.
Over here I'm updating the tree on the backend, and I return a JSON with new nodes. I'm rendering the nodes differently based on their position.
How can I update the tree based on the new nodes we fetched?
I tried to do
this.nodes = ...
from within theonChange
, but I didn't see a change.The text was updated successfully, but these errors were encountered: