Git Product home page Git Product logo

Comments (25)

Saideprinz avatar Saideprinz commented on July 30, 2024 1

I saw the JStree documentation but i couldnt get the basic ajax demo code. And also its not in angular js. Could you please help me with an angular example using ngJStree for binding event to do lazy load on parent node click. I am very new to angularjs and this plugin. Thanks for your help in advance.

from ngjstree.

7899 avatar 7899 commented on July 30, 2024 1

Is there a way to set Children to True yet? If not then can someone please give an example of @AlenkaM workaround? I don't fully understand how to implement the part in bold:

As a workaround, I am applying an empty child object now. Then set propery li_attr ={class: "hidden"} to this child. So after the list is expanded the empty child is not shown. Maybe this can help somebody.

Thanks.

from ngjstree.

ezraroi avatar ezraroi commented on July 30, 2024

Hi, you should bind for the select or expend events. In the jstree documentation you can find some examples

from ngjstree.

hiteshgaur avatar hiteshgaur commented on July 30, 2024

I would also like to have a sample code for ngJsTree with lazy loading. I am able to bind it correctly for the first time by making a separate $http call and recreating the tree instance, but when expanding a node which will need to load children asynchronously it produces following error.

error from js tree - {"error":"nodata","plugin":"core","id":"core_05","reason":"Could not load node","data":"{"id":"4"}"}

if thread has been closed with any solution, it would have been better.

Thanks in advance.

from ngjstree.

Mateo-Luzi avatar Mateo-Luzi commented on July 30, 2024

Yea I also have this problem. The only way that ngJsTree will detect any model changes is when I re-create the tree with version++. If I push anything to the treeData array, nothing happens (if I don't re-create). This problem has been plaguing me for a week now and I have no idea what I can still try to solve this...

from ngjstree.

ezraroi avatar ezraroi commented on July 30, 2024

You can see in the demo page that changes are detected automatically without tree recreation

from ngjstree.

Mateo-Luzi avatar Mateo-Luzi commented on July 30, 2024

Liujoey's fix from issue #14 worked for me for whatever reason.

from ngjstree.

AlenkaM avatar AlenkaM commented on July 30, 2024

Hello! Did you make any progress with issue #27?

I am receiving the same error, when trying to call a function on 'before_open' event, having children: true property in my object.

error from js tree - {"error":"nodata","plugin":"core","id":"core_05","reason":"Could not load node","data":"..

I set this property to true in order to get expand icon shown, when node does not have children.

I did not find any other way to show expand icon without assigning a child object, which I am trying to avoid, because it will slow down my application considerably.

from ngjstree.

ezraroi avatar ezraroi commented on July 30, 2024

Will try to implement this, but i am not sure i will have time in near future.

from ngjstree.

AlenkaM avatar AlenkaM commented on July 30, 2024

Ok, it can be really great if you solve it.

As a workaround, I am applying an empty child object now. Then set propery li_attr ={class: "hidden"} to this child. So after the list is expanded the empty child is not shown. Maybe this can help somebody.

from ngjstree.

jainsaurabh83 avatar jainsaurabh83 commented on July 30, 2024

As workaround I tried to add dummy node and on expand (before_open) i deleted that dummy node.
But when i delete dummy node it selects the parent. please look into checkbox plugin as well

from ngjstree.

icruces avatar icruces commented on July 30, 2024

+1 "children: true" issue

from ngjstree.

vsonone avatar vsonone commented on July 30, 2024

Looks like the data option for ngjstree is overridden by the following block in getOptions() method. If I comment the line config.core.data = scope.treeData, then the ngjstree starts working with ajax mode. But I have not tested other behavior of the tree. Thoughts ?
if (config.core) {
// config.core.data = scope.treeData;
}
else {
config.core = { data: scope.treeData };
}

from ngjstree.

ezraroi avatar ezraroi commented on July 30, 2024

The angular tree should not work with Ajax. When you comment this line you break the 2 way binding. You can load in Ajax data but you should add it to the array of the nodes inside apply cycle

from ngjstree.

vsonone avatar vsonone commented on July 30, 2024

Yeah, after further testing, I found that.

I have a tree which can have potential 60K nodes, what are my alternatives ? If I load everything at once, then tree becomes unresponsive and often leads to a browser crash, not a good user experience.

Any suggestions ?

from ngjstree.

ezraroi avatar ezraroi commented on July 30, 2024

Catch the right event if the tree and load your data async with $http or Ajax. After it create nodes objects and push them to the 2 way binding array.... this should work. Check the demo page

from ngjstree.

gaving avatar gaving commented on July 30, 2024

@AlenkaM 👍 for the suggested workaround, hours trying to debug the non firing of before_open!

from ngjstree.

gauravbhavsar avatar gauravbhavsar commented on July 30, 2024

Any update on children: true issue ?
Having same problem.

from ngjstree.

ezraroi avatar ezraroi commented on July 30, 2024

did you try the workaround of @AlenkaM ?

from ngjstree.

gauravbhavsar avatar gauravbhavsar commented on July 30, 2024

Yes, for now I am using befor_open to load grandChild.

from ngjstree.

renandegrandi avatar renandegrandi commented on July 30, 2024

+1 Child true, and not be necessary to rebuild the entire tree

from ngjstree.

tolya199178 avatar tolya199178 commented on July 30, 2024

How can I setting loading icon while loading data?

from ngjstree.

vrohini avatar vrohini commented on July 30, 2024

HI All,

I am using
function beforeOpen(e, item) {

//and trying to assign children to parent node
}

I can see the $scope.treeData is update but my tree is not refreshed with new data and clue?

from ngjstree.

sauliuni avatar sauliuni commented on July 30, 2024

@7899 just set to your item following property:
item.li_attr = {class:'hidden'};

from ngjstree.

dmitryt avatar dmitryt commented on July 30, 2024

Hello. I was faced with the same problem. As a workaround I used function for ng-model:

vm.treeData = function(node, cb) {
    loadChildren(node.id).then(function(res) {
        cb(prepareData(res));
    })
}

AFAIU, it's handled here.
I'm not sure that it's the best solution, but it works for me =)

from ngjstree.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.