Sha256: 8dea0ce17372abaa81489fe8616b339693a3cb35e23cf642e0acd8834de3d6c7
Contents?: true
Size: 899 Bytes
Versions: 7
Compression:
Stored size: 899 Bytes
Contents
--- title: loadData name: functions-loaddata --- **function loadData(data);** **function loadData(data, parent_node);** Load data in the tree. The data is array of nodes. You can **replace the whole tree** or you can **load a subtree**. {% highlight js %} // Assuming the tree exists var new_data = [ { label: 'node1', children: [ { label: 'child1' }, { label: 'child2' } ] }, { label: 'node2', children: [ { label: 'child3' } ] } ]; $('#tree1').tree('loadData', new_data); {% endhighlight %} Load a subtree: {% highlight js %} // Get node by id (this assumes that the nodes have an id) var node = $('#tree1').tree('getNodeById', 100); // Add new nodes var data = [ { label: 'new node' }, { label: 'another new node' } ]; $('#tree1').tree('loadData', data, node); {% endhighlight %}
Version data entries
7 entries across 7 versions & 1 rubygems