1
|
<!DOCTYPE html
|
2
|
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
5
|
<head>
|
6
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
7
|
<title>jsTree v.1.0 - cookies documentation</title>
|
8
|
<script type="text/javascript" src="../_lib/jquery.js"></script>
|
9
|
<script type="text/javascript" src="../_lib/jquery.cookie.js"></script>
|
10
|
<script type="text/javascript" src="../_lib/jquery.hotkeys.js"></script>
|
11
|
<script type="text/javascript" src="../jquery.jstree.js"></script>
|
12
|
|
13
|
<link type="text/css" rel="stylesheet" href="syntax/!style.css"/>
|
14
|
<link type="text/css" rel="stylesheet" href="!style.css"/>
|
15
|
<script type="text/javascript" src="syntax/!script.js"></script>
|
16
|
</head>
|
17
|
<body>
|
18
|
<div id="container">
|
19
|
|
20
|
<h1>jsTree v.1.0 - cookies plugin</h1>
|
21
|
<h2>Description</h2>
|
22
|
<div id="description">
|
23
|
<p>The <code>cookies</code> enables jstree to save the state of the tree across sessions. What this does is save the opened and selected nodes in a cookie, and reopen & reselect them the next time the user loads the tree. Depends on the <a href="http://plugins.jquery.com/project/cookie">jQuery.cookie</a> plugin.</p>
|
24
|
</div>
|
25
|
|
26
|
<h2 id="configuration">Configuration</h2>
|
27
|
<div class="panel configuration">
|
28
|
|
29
|
<h3>save_opened</h3>
|
30
|
<p class="meta">A string (or <code>false</code>). Default is <code>"jstree_open"</code>.</p>
|
31
|
<p>The name of the cookie to save opened nodes in. If set to <code>false</code> - opened nodes won't be saved.</p>
|
32
|
|
33
|
<h3>save_selected</h3>
|
34
|
<p class="meta">A string (or <code>false</code>). Default is <code>"jstree_select"</code>.</p>
|
35
|
<p>The name of the cookie to save selected nodes in. If set to <code>false</code> - selected nodes won't be saved.</p>
|
36
|
|
37
|
<h3>auto_save</h3>
|
38
|
<p class="meta">A Boolean. Default is <code>true</code>.</p>
|
39
|
<p>If set to <code>true</code> jstree will automatically update the cookies every time a change in the state occurs.</p>
|
40
|
|
41
|
<h3>cookie_options</h3>
|
42
|
<p class="meta">An object. Default is <code>{}</code>.</p>
|
43
|
<p>The options accepted by the <a href="http://plugins.jquery.com/project/cookie">jQuery.cookie</a> plugin.</p>
|
44
|
|
45
|
</div>
|
46
|
|
47
|
<h2 id="demos">Demos</h2>
|
48
|
<div class="panel">
|
49
|
<p>Check your data plugin documentation (<a href="html_data.html">html_data</a>, <a href="xml_data.html">xml_data</a>, <a href="json_data.html">json_data</a>) or take a close look at these examples for information on how to specify multilanguage nodes.</p>
|
50
|
|
51
|
<h3>Using the cookies plugin</h3>
|
52
|
<p>Go ahead and make changes to the tree and then <a href="javascript:document.location.reload();">refresh this page</a>.</p>
|
53
|
<div id="demo1" class="demo">
|
54
|
<ul>
|
55
|
<li id="phtml_1">
|
56
|
<a href="#">Root node 1</a>
|
57
|
<ul>
|
58
|
<li id="phtml_2">
|
59
|
<a href="#">Child node 1</a>
|
60
|
</li>
|
61
|
<li id="phtml_3">
|
62
|
<a href="#">Child node 2</a>
|
63
|
</li>
|
64
|
</ul>
|
65
|
</li>
|
66
|
<li id="phtml_4">
|
67
|
<a href="#">Root node 2</a>
|
68
|
</li>
|
69
|
</ul>
|
70
|
</div>
|
71
|
<script type="text/javascript" class="source">
|
72
|
$(function () {
|
73
|
$("#demo1").jstree({
|
74
|
"plugins" : [ "themes", "html_data", "ui", "cookies" ]
|
75
|
});
|
76
|
});
|
77
|
</script>
|
78
|
|
79
|
</div>
|
80
|
|
81
|
<h2 id="api">API</h2>
|
82
|
<div class="panel api">
|
83
|
|
84
|
<h3 id="save_cookie">.save_cookie ( event )</h3>
|
85
|
<p>Save the current state.</p>
|
86
|
<ul class="arguments">
|
87
|
<li>
|
88
|
<code class="tp">string</code> <strong>event</strong>
|
89
|
<p>Used internally with the <code>auto_save</code> option. Do not set this manually.</p>
|
90
|
</li>
|
91
|
</ul>
|
92
|
</div>
|
93
|
|
94
|
</div>
|
95
|
</body>
|
96
|
</html>
|