question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What is the data format

See original GitHub issue

i’m kinda of stuck here, and need some help in getting the tree displayed.

  1. I did play with jstree first, and load the following data correctly. I know the only thing matters is the text and state, but I need the rest of data there for other purpose.
[
    {
        "created": "",
        "name": "/",
        "type": "directory",
        "size": 0,
        "children": [
            {
                "created": "1422994495000",
                "name": "homepage",
                "type": "directory",
                "size": 136,
                "children": [
                    {
                        "created": "1422994489000",
                        "name": "carasole",
                        "type": "directory",
                        "size": 68,
                        "children": [],
                        "text": "carasole",
                        "state": {
                            "opened": true
                        }
                    }
                ],
                "text": "homepage",
                "state": {
                    "opened": true
                }
            },
            {
                "created": "1422994495000",
                "name": "others",
                "type": "directory",
                "size": 204,
                "children": [
                    {
                        "created": "1422993066000",
                        "name": "bc",
                        "type": "directory",
                        "size": 68,
                        "children": [],
                        "text": "bc",
                        "state": {
                            "opened": true
                        }
                    }
                ],
                "text": "others",
                "state": {
                    "opened": true
                }
            }
        ],
        "text": "/",
        "state": {
            "opened": true
        }
    }
]
  1. I used the following line
                <div js-tree ng-model="treeData" tree-events="ready:treeReady;create_node:createNodeCB"></div>

and monitored the treeReady so that i know the tree is loaded

  1. I know the treeData is there, because I can print it {{ treeData }}

  2. however my tree is not displaying, so i wonder what i did wrong. Btw i didn’t set any treeConfig. please help.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ezraroicommented, Feb 5, 2015

By the way, you can achieve this without recreating the tree. Declare all the configuration in an object, and provide an empty array for the treeData. Once your $http request is finished, push all the data that you need to the treeData array and don’t replace its reference. This will work for sure, as this is the right way to use it.

0reactions
Rabi-Narayancommented, Jan 25, 2016

H jsfile.txt

i ezraroi, modified in the way u suggested to make empty array and pushed the response data but it failed to create child nodes and gives error while trying to open a parent node. treeCtrl: error from js tree - {“error”:“nodata”,“plugin”:“core”,“id”:“core_05”,“reason”:“Could not load node”,“data”:“{"id":"ajson1"}”}

my config and data to load initial tree is like this.Given some initial data to populate tree because it is not creating any node in other ways. vm.treeData = [ { id : ‘ajson1’, parent : ‘#’, text : ‘Simple root node’, state: { opened: false},children:true }, { id : ‘ajson2’, parent : ‘#’, text : ‘Root node 2’, state: { opened: false},children:true }, ];

    vm.treeConfig = {
        core : {
            multiple : false,
            animation: true,
            error : function(error) {
                $log.error('treeCtrl: error from js tree - ' + angular.toJson(error));
            },
            check_callback : true,
            worker : true
        },
        types : {
            default : {
                icon : 'glyphicon glyphicon-flash'
            },
            star : {
                icon : 'glyphicon glyphicon-star'
            },
            cloud : {
                icon : 'glyphicon glyphicon-cloud'
            }
        },
        version : 1,
        plugins : ['types','checkbox']
    };

I am getting data from http service like this:

var promise = ravensService.getChildren();

I am calling the follwing function on “open_node” event of jsTree.But before this event i am getting above error 😦 vm.openChildNode = function() { vm.treeData.push(data.data); };

    promise.then(function (data)
    {
    vm.treeData = data.data;
    console.log(vm.treeData);
    });

I have tried all the stuffs and working on same from days but unable to find solution.I am using jsTree in Angularjs.Since i am new to this please help in this regard.Thanks in advance.PFA for Js.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Data Format - C3 AI
Data format is the definition of the structure of data within a database or file system that gives the information its meaning. Structured...
Read more >
Data format - Wikipedia
Data format · Audio format, a format for encoded sound data · Video format, a format for encoded video data.
Read more >
3 types of Data Formats Explained
The data format is said to be a kind of format which is used for coding the data. The data is coded in...
Read more >
Data format Definition, Meaning & Synonyms
data format the organization of information according to preset specifications (usually for computer processing) ; date from belong to an earlier time ;...
Read more >
What is a data format?
A data format is the arrangement of data fields for a specific shape. After you arrange data fields on a shape, you can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found