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 - sort 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 - sort plugin</h1>
|
21
|
<h2>Description</h2>
|
22
|
<div id="description">
|
23
|
<p>The <code>sort</code> enables jstree to automatically sort all nodes using a specified function. This means that when the user creates, renames or moves nodes around - they will automatically sort.</p>
|
24
|
</div>
|
25
|
|
26
|
<h2 id="configuration">Configuration</h2>
|
27
|
<div class="panel configuration">
|
28
|
|
29
|
<p>Expects a function. The functions receives two arguments - two nodes to be compared. Return <code>-1</code> or <code>1</code>. Default is: </p>
|
30
|
<p><code>function (a, b) { return this.get_text(a) > this.get_text(b) ? 1 : -1; }</code></p>
|
31
|
|
32
|
</div>
|
33
|
|
34
|
<h2 id="demos">Demos</h2>
|
35
|
<div class="panel">
|
36
|
<h3>Using the sort plugin</h3>
|
37
|
<input type="button" class="button" value="rename" id="rename" style="" />
|
38
|
<div id="demo1" class="demo">
|
39
|
<ul>
|
40
|
<li id="phtml_1">
|
41
|
<a href="#">Root node 1</a>
|
42
|
<ul>
|
43
|
<li id="phtml_2">
|
44
|
<a href="#">Child node 1</a>
|
45
|
</li>
|
46
|
<li id="phtml_3">
|
47
|
<a href="#">Child node 2</a>
|
48
|
</li>
|
49
|
</ul>
|
50
|
</li>
|
51
|
<li id="phtml_4">
|
52
|
<a href="#">Root node 2</a>
|
53
|
</li>
|
54
|
</ul>
|
55
|
</div>
|
56
|
<script type="text/javascript" class="source">
|
57
|
$(function () {
|
58
|
$("#rename").click(function () {
|
59
|
$("#demo1").jstree("rename");
|
60
|
});
|
61
|
$("#demo1").jstree({
|
62
|
"plugins" : [ "themes", "html_data", "ui", "crrm", "sort" ]
|
63
|
});
|
64
|
});
|
65
|
</script>
|
66
|
|
67
|
</div>
|
68
|
|
69
|
<h2 id="api">API</h2>
|
70
|
<div class="panel api">
|
71
|
|
72
|
<h3 id="sort">.sort ( node )</h3>
|
73
|
<p>Sorts the children of the specified node - this function is called automatically.</p>
|
74
|
<ul class="arguments">
|
75
|
<li>
|
76
|
<code class="tp">mixed</code> <strong>node</strong>
|
77
|
<p>This can be a DOM node, jQuery node or selector pointing to the element.</p>
|
78
|
</li>
|
79
|
</ul>
|
80
|
</div>
|
81
|
|
82
|
</div>
|
83
|
</body>
|
84
|
</html>
|