Comments (12)
When the tree.load_data
is event is sent, the tree is not yet initialized. That is the reason that getNodeByd
doesn't work.
I'll have a look if it's possible to change this.
from jqtree.
I was unable to find a way to manually open nodes after onCreateLi, where i use to customize each node. So the only way to do this was foreach node, inside onCreateLi, to add/remove css classes so to open the current node when required. But it would be great if there was an event to call after all initialization was done, including the customization of the nodes.
from jqtree.
I'm of thinking of adding a tree.reinit
event, that is called when the whole tree is reloaded. You could then listen to the tree.init
and tree.reinit
events if you want to handle a tree reload.
tree.init
: called when the tree is initialized; this event is called only once.tree.reinit
: called when the tree is re-initialized;
Background: I cannot call tree.init
on tree reload because this breaks existing code.
It's implemented in this pr: #705. It's a work in progress, but it does work.
NB: this only works if you reload the entire tree.
Would this work for in your situation?
from jqtree.
well i'm not sure. What i actually want to achieve is that after loadDataFromUrl, i customize each node of the tree to add a custom button, using onCreateLi. After customizing all the nodes, i want to parse each node of the tree, and open some nodes i choose. My current problemt is that i cannot find an event to check wheter the onCreateLi has finished, and all nodes are visible, so to parse each node individualy.
from jqtree.
When you call loadDataFromUrl
, are you reloading the whole tree, or only part of the tree?
Background: it's possible to load part of the tree by using the parentNode
parameter. https://mbraak.github.io/jqTree/#functions-loaddatafromurl
from jqtree.
In my case i need to reload the whole tree, thats why everytime i have to customize the nodes. I think if there was an event like "onDrawFinished" which is fired after all the nodes are draw, it would be the best.
from jqtree.
I updated pr #705. It now triggers the tree.load_data
event after the tree is (reloaded and) redrawn.
I think this should work with your original code that handles the tree.load_data
event.
from jqtree.
@yakamuki Can I ask you to test if the #705 pull request fixes the issue? The tree.load_data
event is triggered after drawing the tree, so the getNodeById
call should work.
from jqtree.
@mbraak i'll give it a try now. I'm currently working on a project and installed the library via "npm"
from jqtree.
@mbraak it works great. The tree.load_data
event is triggered after the whole tree is drawn, so now i can manipulate all the nodes i need. Thanks
from jqtree.
Thanks for testing! I'll merge the pr.
from jqtree.
Version 1.7.0 is just published, including this fix.
from jqtree.
Related Issues (20)
- What can I do if I choose only child multiple times HOT 6
- How to export and import jqTree data? HOT 9
- Rename selected node HOT 3
- Autoscroll - top level dragged item no scroll over the items under it. HOT 20
- Feature: ES6 support HOT 9
- Behavior changed with 1.7.0 HOT 3
- Set jQuery as a peer dependency
- Fix eslint import error
- Is documentation page dead? HOT 4
- Inconsistent/incorrect drag & drop node highlighting HOT 9
- New root node missing icon HOT 3
- AddToSelection doesn't seem to use "mustSetFocus" HOT 4
- How to use jqTree with jQuery latest version 3.7.1 in ASP.NET HOT 4
- getPreviousNode() behaves differently HOT 4
- changed documentation? HOT 2
- function onCanMoveTo can't be override HOT 2
- Drag & Drop multiple nodes HOT 4
- Injection vulnerability because of lodash.template HOT 3
- The tree is not rendered, nothing happens.
- ContextMenuEvent 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 jqtree.