Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9220845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:26:36+00:00 2026-06-18T03:26:36+00:00

i got this jsTree: $(function () { $(#tree).jstree({ json_data : { data : [

  • 0

i got this jsTree:

$(function () {
    $("#tree").jstree({
        "json_data" : {
            "data" : [
                {
                    "data" : "<?php echo $db_obj->getValue('article_group_name') ?>",
                    "metadata" : { id : 23 },
                    "children" : [ "Child 1", "A Child 2" ]
                }
            ]
        },
        "plugins" : ["themes","json_data", "ui" ]
    });
});

I would like to populate it with DB data. The Childs should be line from the database.
I json_encoded the table data, it looks something like this:

[Object { article_id=

"4949"

,  article_name_internal=

"Nachtlampe Lumilove Barbapapa"

}, Object { article_id=

"4947"

,  article_name_internal=

"Wanduhr Silk von Koziol"

},

Whene i click one of the childs it should go to that page. Not sure how i can populate the tree with this data. Any instructions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:26:37+00:00Added an answer on June 18, 2026 at 3:26 am

    Each node for jsTree have a list of attributes that you can set to it.
    just use the attr property in your JSON and add an array of property-value pairs that represent the data you want.

    one of these properties should be an href containing the URL for the page you want to opent once someone clicks the node for your jsTree.

    now your server should return the data like this.

    {
        "data": "Root",
        "attr": {
            "id": "1",
            "rel": "Root",
            "type": 0
        },
        "children": [{
            "data": "Test 1",
            "attr": {
                "id": "2",
                "href": "http://www.google.com"
                "rel": "OrganizationalUnit",
                "type": 1
            },
            "children": [],
            "state": "open"
        }],
        "state": "open"
    }
    

    and your JSTree inint function should do something like that:

    k_OrgTree = $("#OrgTree").jstree({
            json_data: {
                ajax: {
                    url: "/Administration/PopulateTree",
                    type: "POST",
                    dataType: "json",
                    contentType: "application/json charset=utf-8",
                    success: function (data) { }
                }
            },
            themes: currentTheme,
            types: {
                valid_children: [k_Root],
                types: {
                    Root: {
                        valid_children: [k_OrganizationalUnit, k_Calendar],
                        icon: { image: "/Content/Administration/Images/Root/Root_32x32.png" },
                        delete_node: false,
                    },
                    OrganizationalUnit: {
                        valid_children: [k_OrganizationalUnit, k_Calendar, k_User],
                        icon: { image: "/Content/Administration/Images/OrganizationalUnit/OrganizationalUnit_32x32.png" },
                    },
                    Calendar: {
                        valid_children: ["none"],
                        icon: { image: "/Content/Administration/Images/Calendar/Calendar_32x32.png" },
                        create_node: false
                    },
                    User: {
                        valid_children: ["none"],
                        icon: { image: "/Content/Administration/Images/User/User_32x32.png" },
                        create_node: false
                    }
                }
            },
    
            plugins: ["themes", "json_data", "types", "ui"]
    
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Got this function for ammending the query string and was wondering what the replacement
Got this code so far for my send button: NSString* urlString = [NSString stringWithFormat:@http://server.com/ios/add.php?user=iPhone+App&message=%@,
Got this code from here http://www.irunmywebsite.com/raphael/drawtool2.php . Runs great in IE when I tested
Got this error while call the function static public void DisplayAJAXMessage(Control page, string msg)
Got this SQL: SELECT DISTINCT(LocCity), LocZipCode FROM exp_course_events order by LocCity and this data:
Got this errors keeps appeared repeatedly Here is my line 20 on functions.php $wp_query->max_num_pages
Got this error message while trying to load view: The model item passed into
Got this line of code here but its not working. private void Button_Click(object sender,
Got this site with UN/PW set via the Createuserwizard control. Client considers PW too
Got this: Table a ID RelatedBs 1 NULL 2 NULL Table b AID ID

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.