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 - UI 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 - UI plugin</h1>
|
21
|
<h2>Description</h2>
|
22
|
<div id="description">
|
23
|
<p>The <code>UI</code> plugin handles selecting, deselecting and hovering tree items.</p>
|
24
|
</div>
|
25
|
|
26
|
<h2 id="configuration">Configuration</h2>
|
27
|
<div class="panel configuration">
|
28
|
<h3>select_limit</h3>
|
29
|
<p class="meta">A number. Default is <code>-1</code>.</p>
|
30
|
<p>Defines how many nodes can be selected at a given time (<code>-1</code> means unlimited).</p>
|
31
|
|
32
|
<h3>select_multiple_modifier</h3>
|
33
|
<p class="meta">A string. Default is <code>"ctrl"</code>.</p>
|
34
|
<p>The special key used to make a click add to the selection and not replace it (<code>"ctrl"</code>, <code>"shift"</code>, <code>"alt"</code>, <code>"meta"</code>).<br />You can also set this to <code>"on"</code> making every click add to the selection.</p>
|
35
|
|
36
|
<h3>selected_parent_close</h3>
|
37
|
<p class="meta">A string (or <code>false</code>). Default is <code>"select_parent"</code>.</p>
|
38
|
<p>What action to take when a selected node's parent is closed (making the selected node invisible). Possible values are <code>false</code> - do nothing, <code>"select_parent"</code> - select the closed node's parent and <code>"deselect"</code> - deselect the node.</p>
|
39
|
|
40
|
<h3>select_prev_on_delete</h3>
|
41
|
<p class="meta">A boolean. Default is <code>true</code>.</p>
|
42
|
<p>If set to <code>true</code> when a selected node is deleted, its previous sibling (or parent) is selected.</p>
|
43
|
|
44
|
<h3>disable_selecting_children</h3>
|
45
|
<p class="meta">A boolean. Default is <code>false</code>.</p>
|
46
|
<p>If set to <code>true</code> you will not be able to select children of already selected nodes.</p>
|
47
|
|
48
|
<h3>initially_select</h3>
|
49
|
<p class="meta">An array. Default is <code>[]</code>.</p>
|
50
|
<p>Defines which nodes are to be automatically selected when the tree finishes loading - a list of IDs is expected.</p>
|
51
|
|
52
|
</div>
|
53
|
|
54
|
<h2 id="demos">Demos</h2>
|
55
|
<div class="panel">
|
56
|
|
57
|
<h3>Using the UI plugin</h3>
|
58
|
<div id="demo1" class="demo">
|
59
|
<ul>
|
60
|
<li id="phtml_1">
|
61
|
<a href="#">Root node 1</a>
|
62
|
<ul>
|
63
|
<li id="phtml_2">
|
64
|
<a href="#">Child node 1</a>
|
65
|
</li>
|
66
|
<li id="phtml_3">
|
67
|
<a href="#">Child node 2</a>
|
68
|
</li>
|
69
|
</ul>
|
70
|
</li>
|
71
|
<li id="phtml_4">
|
72
|
<a href="#">Root node 2</a>
|
73
|
</li>
|
74
|
</ul>
|
75
|
</div>
|
76
|
<script type="text/javascript" class="source">
|
77
|
$(function () {
|
78
|
$("#demo1").jstree({
|
79
|
"ui" : {
|
80
|
"select_limit" : 2,
|
81
|
"select_multiple_modifier" : "alt",
|
82
|
"selected_parent_close" : "select_parent",
|
83
|
"initially_select" : [ "phtml_2" ]
|
84
|
},
|
85
|
"core" : { "initially_open" : [ "phtml_1" ] },
|
86
|
"plugins" : [ "themes", "html_data", "ui" ]
|
87
|
});
|
88
|
});
|
89
|
</script>
|
90
|
|
91
|
</div>
|
92
|
|
93
|
<h2 id="api">API</h2>
|
94
|
<div class="panel api">
|
95
|
|
96
|
<h3 id="_get_node">._get_node ( node , allow_multiple )</h3>
|
97
|
<p>Overrides the function form the <a href="core.html#_get_node">core</a> module.<br />if <code>node</code> is <code>undefined</code> or <code>null</code> and <code>allow_multiple</code> is <code>true</code> all the currently selected nodes are returned<br />if <code>node</code> is <code>undefined</code> or <code>null</code> and <code>allow_multiple</code> is NOT <code>true</code> only the last selected node is returned.</p>
|
98
|
<ul class="arguments">
|
99
|
<li>
|
100
|
<code class="tp">mixed</code> <strong>node</strong>
|
101
|
<p>This can be a DOM node, jQuery node or selector pointing to an element within the tree.</p>
|
102
|
</li>
|
103
|
<li>
|
104
|
<code class="tp">boolean</code> <strong>allow_multiple</strong>
|
105
|
<p>Whether to return all selected nodes or only the last selected one if <code>node</code> is <code>null</code>.</p>
|
106
|
</li>
|
107
|
</ul>
|
108
|
|
109
|
<h3 id="save_selected">.save_selected ( )</h3>
|
110
|
<p>Saves away the current selection state of the tree (saves it in a variable, so do not expect a restore after a refresh - for that functionality refer to the <a href="cookies.html">cookies plugin</a>. Used mostly internally. Triggers an event.</p>
|
111
|
|
112
|
<h3 id="reselect">.reselect ( )</h3>
|
113
|
<p>Restores the state of the tree using the variable saved in the above function. Used mostly internally. Triggers an event.</p>
|
114
|
|
115
|
<h3 id="refresh">.refresh ( node )</h3>
|
116
|
<p>Overrides the function form the <a href="core.html#refresh">core</a> module.<br />Enables saving the selection state before the refresh and restoring it afterwards.</p>
|
117
|
|
118
|
<h3 id="hover_node">.hover_node ( node )</h3>
|
119
|
<p>Sets the specified node as hovered. Triggers an event.</p>
|
120
|
<ul class="arguments">
|
121
|
<li>
|
122
|
<code class="tp">mixed</code> <strong>node</strong>
|
123
|
<p>This can be a DOM node, jQuery node or selector pointing to an element within the tree.</p>
|
124
|
</li>
|
125
|
</ul>
|
126
|
|
127
|
<h3 id="dehover_node">.dehover_node ( )</h3>
|
128
|
<p>Removes the hover state from the currently hovered node (if there is one). Triggers an event.</p>
|
129
|
|
130
|
|
131
|
<h3 id="select_node">.select_node ( node , check , event )</h3>
|
132
|
<ul class="arguments">
|
133
|
<li>
|
134
|
<code class="tp">mixed</code> <strong>node</strong>
|
135
|
<p>This can be a DOM node, jQuery node or selector pointing to an element within the tree.</p>
|
136
|
</li>
|
137
|
<li>
|
138
|
<code class="tp">bool</code> <strong>check</strong>
|
139
|
<p>Whether to check the specified rules and do appropriate actions (check <code>select_limit</code>, deselect other nodes respectively, etc) or to just force selection of the node regardless of <code>select_limit</code>.</p>
|
140
|
</li>
|
141
|
<li>
|
142
|
<code class="tp">event</code> <strong>event</strong>
|
143
|
<p>Used internally - when a click on a node caused this function to be executed.</p>
|
144
|
</li>
|
145
|
</ul>
|
146
|
|
147
|
<div style="height:1px; visibility:hidden; overflow:hidden;"><span id="toggle_select"> </span></div>
|
148
|
<h3 id="deselect_node">.deselect_node ( node ), .toggle_select ( node )</h3>
|
149
|
<p>There functions control the selected state on a node. <code>deselect_node</code> triggers an event.</p>
|
150
|
<ul class="arguments">
|
151
|
<li>
|
152
|
<code class="tp">mixed</code> <strong>node</strong>
|
153
|
<p>This can be a DOM node, jQuery node or selector pointing to an element within the tree.</p>
|
154
|
</li>
|
155
|
</ul>
|
156
|
|
157
|
<h3 id="deselect_all">.deselect_all ( context )</h3>
|
158
|
<p>Deselects all selected nodes. If context is set - only the selected nodes within that context are deselected. Triggers an event.</p>
|
159
|
<ul class="arguments">
|
160
|
<li>
|
161
|
<code class="tp">mixed</code> <strong>context</strong>
|
162
|
<p>This can be a DOM node, jQuery node or selector pointing to an element within the tree.</p>
|
163
|
</li>
|
164
|
</ul>
|
165
|
|
166
|
<h3 id="get_selected">.get_selected ( context )</h3>
|
167
|
<p>Returns all selected nodes. If context is set - only the selected nodes within that context are returned.</p>
|
168
|
<ul class="arguments">
|
169
|
<li>
|
170
|
<code class="tp">mixed</code> <strong>context</strong>
|
171
|
<p>This can be a DOM node, jQuery node or selector pointing to an element within the tree.</p>
|
172
|
</li>
|
173
|
</ul>
|
174
|
|
175
|
<h3 id="is_selected">.is_selected ( node )</h3>
|
176
|
<p>Returns whether the specified node is selected or not.</p>
|
177
|
<ul class="arguments">
|
178
|
<li>
|
179
|
<code class="tp">mixed</code> <strong>node</strong>
|
180
|
<p>This can be a DOM node, jQuery node or selector pointing to an element within the tree.</p>
|
181
|
</li>
|
182
|
</ul>
|
183
|
|
184
|
</div>
|
185
|
|
186
|
</div>
|
187
|
</body>
|
188
|
</html>
|