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 - languages 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 - languages plugin</h1>
|
21
|
<h2>Description</h2>
|
22
|
<div id="description">
|
23
|
<p>The <code>languages</code> plugin enables multilanguage trees. This means that each node has a specified number of titles - each in a different "language". Only one language set is visible at any given time. This is useful for maintaining the same structure in many languages (hence the name of the plugin)</p>
|
24
|
</div>
|
25
|
|
26
|
<h2 id="configuration">Configuration</h2>
|
27
|
<div class="panel configuration">
|
28
|
<p>Expects an array of language codes. Each of the items is used as a CSS class name, so make sure you specify only valid CSS class name strings. The first langauge will be visible onload. For example:</p>
|
29
|
<p><code>[ "en", "de", "bg" ]</code></p>
|
30
|
</div>
|
31
|
|
32
|
<h2 id="demos">Demos</h2>
|
33
|
<div class="panel">
|
34
|
<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>
|
35
|
|
36
|
<h3>Using the languages plugin with HTML data</h3>
|
37
|
<input type="button" class="button" value="en" id="en_1" style="float:left;" />
|
38
|
<input type="button" class="button" value="bg" id="bg_1" style="float:left;" />
|
39
|
<input type="button" class="button" value="rename_1" id="rename_1" style="float:left;" />
|
40
|
<input type="button" class="button" value="rename_2" id="rename_2" style="" />
|
41
|
<div id="demo1" class="demo">
|
42
|
<ul>
|
43
|
<li id="phtml_1">
|
44
|
<a href="#" class="en">Root node 1</a>
|
45
|
<a href="#" class="bg">Корен 1</a>
|
46
|
<ul>
|
47
|
<li id="phtml_2">
|
48
|
<a href="#" class="en">Child node 1</a>
|
49
|
<a href="#" class="bg">Дете 1</a>
|
50
|
</li>
|
51
|
<li id="phtml_3">
|
52
|
<a href="#" class="en">Child node 2</a>
|
53
|
<a href="#" class="bg">Дете 2</a>
|
54
|
</li>
|
55
|
</ul>
|
56
|
</li>
|
57
|
<li id="phtml_4">
|
58
|
<a href="#" class="en">Root node 2</a>
|
59
|
<a href="#" class="bg">Корен 2</a>
|
60
|
</li>
|
61
|
</ul>
|
62
|
</div>
|
63
|
<script type="text/javascript" class="source">
|
64
|
$(function () {
|
65
|
$("#en_1, #bg_1").click(function () {
|
66
|
$("#demo1").jstree("set_lang", this.value);
|
67
|
});
|
68
|
$("#rename_1").click(function () {
|
69
|
$("#demo1").jstree("rename_node", "#phtml_1", "Rename visible lang");
|
70
|
});
|
71
|
$("#rename_2").click(function () {
|
72
|
$("#demo1").jstree("rename_node", "#phtml_1", "Rename `bg`", "bg");
|
73
|
});
|
74
|
$("#demo1").jstree({
|
75
|
"languages" : [ "en", "bg" ],
|
76
|
"plugins" : [ "themes", "html_data", "languages"]
|
77
|
});
|
78
|
});
|
79
|
</script>
|
80
|
|
81
|
</div>
|
82
|
|
83
|
<h2 id="api">API</h2>
|
84
|
<div class="panel api">
|
85
|
|
86
|
<h3 id="set_lang">.set_lang ( lang )</h3>
|
87
|
<p>Set the tree's visible language. Triggers an event.</p>
|
88
|
<ul class="arguments">
|
89
|
<li>
|
90
|
<code class="tp">string <br />number</code> <strong>lang</strong>
|
91
|
<p>Either the language code string (as specified in the config) or an index from the config array.</p>
|
92
|
</li>
|
93
|
</ul>
|
94
|
<h3 id="get_lang">.get_lang ( )</h3>
|
95
|
<p>Returns the name of the currently visible language.</p>
|
96
|
|
97
|
<h3 id="get_text">.get_text ( node , lang )</h3>
|
98
|
<p>Returns the title of a node. Overwrites the <a href="core.html#get_text">get_text function</a> from the core.</p>
|
99
|
<ul class="arguments">
|
100
|
<li>
|
101
|
<code class="tp">mixed</code> <strong>node</strong>
|
102
|
<p>This can be a DOM node, jQuery node or selector pointing to the element whose title you need.</p>
|
103
|
</li>
|
104
|
<li>
|
105
|
<code class="tp">string</code> <strong>lang</strong>
|
106
|
<p>The language code string (as specified in the config) to get the title in. If you omit this - the currently visible language is used.</p>
|
107
|
</li>
|
108
|
</ul>
|
109
|
|
110
|
<h3 id="set_text">.set_text ( node , text , lang )</h3>
|
111
|
<p>Sets the title of a node. Overwrites the <a href="core.html#set_text">set_text function</a> from the core. This is used internally - you should use <a href="core.html#rename_node">rename_node</a>. Since <code>rename_node</code> uses <code>set_text</code> internally you can pass a language string as a third parameter to rename_node.</p>
|
112
|
<ul class="arguments">
|
113
|
<li>
|
114
|
<code class="tp">mixed</code> <strong>node</strong>
|
115
|
<p>This can be a DOM node, jQuery node or selector pointing to the element whose title you want to change.</p>
|
116
|
</li>
|
117
|
<li>
|
118
|
<code class="tp">string</code> <strong>text</strong>
|
119
|
<p>The new title.</p>
|
120
|
</li>
|
121
|
<li>
|
122
|
<code class="tp">string</code> <strong>lang</strong>
|
123
|
<p>The language code string (as specified in the config) to get the title in. If you omit this - the currently visible language is used.</p>
|
124
|
</li>
|
125
|
</ul>
|
126
|
|
127
|
<h3 id="_load_css">._load_css ( )</h3>
|
128
|
<p>used only internally to include the CSS necessary for the plugin onload.</p>
|
129
|
|
130
|
<h3 id="create_node">.create_node ( obj , position , js , callback )</h3>
|
131
|
<p>Overwrites the <a href="core.html#create_node">create_node</a> function from the core. To create a node with a few titles use an array for the <code>data</code> property of the <code>js</code> parameter:</p>
|
132
|
<p><code>{ "data" : [ { "title" : "EN title", language : "en" }, { "title" : "BG заглавие", language : "bg" } ] }</code></p>
|
133
|
|
134
|
</div>
|
135
|
|
136
|
</div>
|
137
|
</body>
|
138
|
</html>
|