Blame view

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