« Example 4 Example 6 »

Example 5 - Load nodes on demand from the server

In this example, the data is loaded on demand from the server.
To use load on demand, you must do the following:

first level of data

[
    {
        "name": "Saurischia",
        "id": 1,
        "load_on_demand": true
    },
    {
        "name": "Ornithischians",
        "id": 23,
        "load_on_demand": true
    }
]

html

<div id="tree1" data-url="/nodes/"></div>

javascript

$('#tree1').tree({
    dragAndDrop: true
});