Sha256: 9c067f5bb0d805455fc2fb9c7ac96cc5aaa32796cc770841bce2d3e18f2be58b

Contents?: true

Size: 1.25 KB

Versions: 7

Compression:

Stored size: 1.25 KB

Contents

---
title: Tutorial
name: Tutorial
---

Include [jQuery](http://code.jquery.com/jquery.min.js)

{% highlight html %}
<script src="jquery.min.js"></script>
{% endhighlight %}

Include tree.jquery.js:

{% highlight html %}
<script src="tree.jquery.js"></script>
{% endhighlight %}

Include jqtree.css:

{% highlight html %}
<link rel="stylesheet" href="jqtree.css">
{% endhighlight %}

Optionally, for saveState include [jquery-cookie](https://github.com/carhartl/jquery-cookie):

{% highlight html %}
<script src="jquery.cookie.js"></script>
{% endhighlight %}

Create a div.

{% highlight html %}
<div id="tree1"></div>
{% endhighlight %}

Create tree data.

{% highlight js %}
var data = [
    {
        label: 'node1',
        children: [
            { label: 'child1' },
            { label: 'child2' }
        ]
    },
    {
        label: 'node2',
        children: [
            { label: 'child3' }
        ]
    }
];
{% endhighlight %}

Create tree widget.

{% highlight js %}
$(function() {
    $('#tree1').tree({
        data: data
    });
});
{% endhighlight %}

Alternatively, get the data from the server.

{% highlight js %}
$.getJSON(
    '/some_url/',
    function(data) {
        $('#tree1').tree({
            data: data
        });
    }
);
{% endhighlight %}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
iqvoc-4.12.1 vendor/assets/bower_components/jqtree/_entries/07_tutorial.md
iqvoc-4.12.0 vendor/assets/bower_components/jqtree/_entries/07_tutorial.md
iqvoc-4.11.1 vendor/assets/bower_components/jqtree/_entries/07_tutorial.md
iqvoc-4.11.0 vendor/assets/bower_components/jqtree/_entries/07_tutorial.md
iqvoc-4.10.0 vendor/assets/bower_components/jqtree/_entries/07_tutorial.md
iqvoc-4.9.0 vendor/assets/bower_components/jqtree/_entries/07_tutorial.md
iqvoc-4.8.2 vendor/assets/bower_components/jqtree/_entries/07_tutorial.md