I have jsTree which I am trying to bi-directionally "connect" to the Meteor collection. Right now, I automatically run jsTree.refresh() whenever the collection is updated with .observeChanges :
FileTree.find().observeChanges({ added: function() { $.jstree.reference('#fileTree').refresh(); }, changed: function() { $.jstree.reference('#fileTree').refresh(); }, removed: function() { $.jstree.reference('#fileTree').refresh(); } });
I want to enable database editing by dragging things into jsTree. Here's what it would look like:
- The user drags the item to a new location.
- jsTree updates the location of an item in the tree.
- jsTree calls an event handler
- Event Handler Database Updates
My problem is that if I understand everything correctly, it is that updating the database will raise the observeChanges event that I set earlier. This will cause another tree update. This causes an annoying flicker that interrupts users. (i.e. the file browser will not be suitable for approximately 0.75 s after each drag and drop operation.)
How can I prevent this unnecessary update, or is there a better way to structure my interface with jsTree that would prevent this problem.
javascript javascript-events meteor jstree
BonsaiOak
source share