?
Solved

JsTree loading data?

Posted on 2014-01-22
3
Medium Priority
?
3,545 Views
Last Modified: 2014-02-06
I am trying to use the JsTree v3.0.

This loads the data into the tree.

$('#tree').jstree({
'core' : {
  'data' : {
    'url' : function (node) {
      return node.id === '#' ? 
        'ajax_roots.json' : 
        'ajax_children.json';
    },
    'data' : function (node) {
      return { 'id' : node.id };
    }
  }
});

Open in new window


Q1) I also saw you can use the .ajax inside of above code.
What's the difference?
THis one use .ajax to request.

$('#file_tree').jstree({
    "plugins": ["json_data", "themes", "ui", "crrm", "dnd", "search", "contextmenu"],
      "json_data" : 
    {
    [quote]    "ajax" : 
        {
            "url" : "{{ url('components/tree/findall') }}",
[/quote]                       "data" : function (node) { 
                    console.info("Nodes:",node);    
                     return {   
                            "operation" : "get_children",
                            "id" : node.attr ? node.attr("id").replace("node_","") : 1
                        };
                    }
        }
    }
})

Open in new window

0
Comment
Question by:dkim18
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 26

Assisted Solution

by:lenamtl
lenamtl earned 1000 total points
ID: 39803932
Depending of your needs and server configuration

With Ajax:
The only difference is that the JSON is not inside the config object, but returned from the server.

http://www.jstree.com/docs/json
0
 
LVL 53

Accepted Solution

by:
Scott Fell,  EE MVE earned 1000 total points
ID: 39805846
If this is something that is used on multiple pages or is a very large file size, it is a good idea to use ajax and load from a url on your server.
0
 

Author Comment

by:dkim18
ID: 39806365
I should had made url to contain same name in both example above.
Let's assume that they are both coming from the web service.

What's the difference?
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question