Comments (19)
Hi,
can you write a plunker with the code? basically you don't have to force, the update should happen automatically. You can look on the demo code for example. Are you using $http to load the data async?
from ngjstree.
I’m using typescript and rectangular (repository). The data.industryHierarchy contains the array of valid nodes. I’m also using the child array approach (versus the parent id).
repositories.industryHierarchy.search($scope.query, IndustryClassification.Any).then(function (data) {
$scope.loading = false
$scope.treeData = data.industryHierarchy
}, function (response) {
$scope.loading = false
$scope.errormessage = response.data.message
services.logger.error('An error occurred searching', response.data)
})
On Oct 30, 2014, at 4:40 PM, Roi Ezra [email protected] wrote:
Hi,
can you write a plunker with the code? basically you don't have to force, the update should happen automatically. You can look on the demo code for example. Are you using $http to load the data async?—
Reply to this email directly or view it on GitHub #7 (comment).
from ngjstree.
If I manually drop in the array, I can see that it supports the parent / child array format.
from ngjstree.
my guess is that there is not dirty checking of angular after the promise is resolved, try to update the tree data inside a $timeout or inside $apply, i think that it will solve your problem
from ngjstree.
That’s likely. I’ve run into this before… but at the same time, I use the exact same approach to update grids and repeaters and it works just fine.
On Oct 30, 2014, at 4:46 PM, Roi Ezra [email protected] wrote:
my guess is that there is not dirty checking of angular after the promise is resolved, try to update the tree data inside a $timeout or inside $apply, i think that it will solve your problem
—
Reply to this email directly or view it on GitHub #7 (comment).
from ngjstree.
I would also suggest that you initialize the treeData with empty array and just push all the nodes to that array once the promise is resolved, because otherwise you are changing the array reference after the tree was created.
from ngjstree.
My same implementation works fine with https://github.com/arvindr21/jsTree-directive https://github.com/arvindr21/jsTree-directive
I ported to yours because I need the ability to set the tree instance to a scope variable….
On Oct 30, 2014, at 4:40 PM, Roi Ezra [email protected] wrote:
Hi,
can you write a plunker with the code? basically you don't have to force, the update should happen automatically. You can look on the demo code for example. Are you using $http to load the data async?—
Reply to this email directly or view it on GitHub #7 (comment).
from ngjstree.
Did you try to initialize the array like i suggested? If you still have the problem i would need a way to reproduce it as loading async data works fine for me on my projects.
from ngjstree.
If you were to change the scope watcher in you code to look at the array instance versus the array contents, how would you go about it?
On Oct 30, 2014, at 4:51 PM, Roi Ezra [email protected] wrote:
I would also suggest that you initialize the treeData with empty array and just push all the nodes to that array once the promise is resolved, because otherwise you are changing the array reference after the tree was created.
—
Reply to this email directly or view it on GitHub #7 (comment).
from ngjstree.
I think that it will miss the whole point of the binding. You don't want to change the array instance on every new item or updated item in the tree. If you want to replace the whole array content you ca do this with the should-apply method. Set the method to return false before you clear the array, make all the changes in the array, update a version property in the jsTree config object, this will cause the tree to destroyed and created again with the new data
from ngjstree.
I have a deliverable and will figure it out tomorrow. Until then, it's angular scope madness.
from ngjstree.
Hi,
i added a section in the ReadMe that explains about how to recreate the tree.
from ngjstree.
I also added async load and tree recreate examples in the demo page of the directive (http://ezraroi.github.io/ngJsTree/). I hope this can help you
from ngjstree.
I applied the timeout to the callback and the tree loaded. Thanks!
P.S. Do you have any examples for asynchronously loading child nodes on expand? Should I catch the expand event and add them then?
from ngjstree.
Hi, yes. This is right way to do this as i see it. Subscribe for the event, and load the data async and add it to the nodes array.
from ngjstree.
Thanks again!
from ngjstree.
np
from ngjstree.
Hello @ezraroi,
It looks like the 'parent' attribute is required for this async operation.
Do you know if there is a way to configure parent as default to '#'?
Thanks!
from ngjstree.
hi . im using angularjs and $http service , and have this issue too . any help ?
from ngjstree.
Related Issues (20)
- search in Firefox causing unresponsive script window popup
- Custom directive for double click event on the tree elements
- support for angular 1.6.x HOT 2
- getting error on using ngJsTree in a modal
- Error for Adding Children
- custom json data
- Open ALL HOT 1
- Upgrade to AngularJS 1.6 HOT 3
- Question: angular 2+ version HOT 1
- context menu and dnd plugins updating model
- two way binding doesn't work inside a directive
- how to use ng-required in ngJsTree?
- Ajax Call
- Update of package on NPM HOT 1
- get_checked method problem
- Set language HOT 1
- Binding mousedown event HOT 1
- Support for Angular 8
- attach separate dnd_stop.vakata event to different selectors
- Can only select either ONE or ALL nodes at any given level
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 ngjstree.