2 title: Load nodes on demand from the server in javascript tree
4 js: examples/load_on_demand.js
9 <a href="../04_save_state/">« Example 4</a>
10 <a href="../06_autoescape/" class="next">Example 6 »</a>
13 <h1>Example 5 - Load nodes on demand from the server</h1>
16 <div id="tree1" data-url="/nodes/"></div>
19 In this example, the data is loaded on demand from the server.
21 To use load on demand, you must do the following:
26 You must specify a <strong>data url</strong>. In this example this is done using the <strong>data-url</strong>
30 Folders that must be loaded on demand must have the <strong>load_on_demand</strong> property. You can specify this in the data.
33 In this example, the url <strong>/nodes/</strong> returns the first level of data (Saurischia and Ornithischians).
36 The url for the load on demand data is <strong><data-url>?node=<node-id></strong>. So, for node 23 this would be
37 <strong>/nodes/?node=23</strong>.
41 <h3>first level of data</h3>
46 "label": "Saurischia",
48 "load_on_demand": true
51 "label": "Ornithischians",
53 "load_on_demand": true
61 <div id="tree1" data-url="/nodes/"></div>