1 |
5703
|
leinfelder
|
<!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 - contextmenu 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 - contextmenu plugin</h1>
|
21 |
|
|
<h2>Description</h2>
|
22 |
|
|
<div id="description">
|
23 |
|
|
<p>The <code>contextmenu</code> plugin enables a contextual menu to be shown, when the user right-clicks a node (or when triggered programatically by the developer).</p>
|
24 |
|
|
</div>
|
25 |
|
|
|
26 |
|
|
<h2 id="configuration">Configuration</h2>
|
27 |
|
|
<div class="panel configuration">
|
28 |
|
|
<h3>select_node</h3>
|
29 |
|
|
<p class="meta">Boolean. Default is <code>false</code>.</p>
|
30 |
|
|
<p>Whether to select the right clicked node when showing the context menu. If this is set to <code>true</code> and the node is not selected all currently selected nodes will be deselected.</p>
|
31 |
|
|
|
32 |
|
|
<h3>show_at_node</h3>
|
33 |
|
|
<p class="meta">Boolean. Default is <code>true</code>.</p>
|
34 |
|
|
<p>Whether to show the context menu just below the node, or at the clicked point exactly.</p>
|
35 |
|
|
|
36 |
|
|
<h3>items</h3>
|
37 |
|
|
<p>Expects an object or a function, which should return an object. If a function is used it fired in the tree's context and receives one argument - the node that was right clicked. The object format is:</p>
|
38 |
|
|
<div style="border:1px solid gray">
|
39 |
|
|
<pre class="brush:js">
|
40 |
|
|
{
|
41 |
|
|
// Some key
|
42 |
|
|
"rename" : {
|
43 |
|
|
// The item label
|
44 |
|
|
"label" : "Rename",
|
45 |
|
|
// The function to execute upon a click
|
46 |
|
|
"action" : function (obj) { this.rename(obj); },
|
47 |
|
|
// All below are optional
|
48 |
|
|
"_disabled" : true, // clicking the item won't do a thing
|
49 |
|
|
"_class" : "class", // class is applied to the item LI node
|
50 |
|
|
"separator_before" : false, // Insert a separator before the item
|
51 |
|
|
"separator_after" : true, // Insert a separator after the item
|
52 |
|
|
// false or string - if does not contain `/` - used as classname
|
53 |
|
|
"icon" : false,
|
54 |
|
|
"submenu" : {
|
55 |
|
|
/* Collection of objects (the same structure) */
|
56 |
|
|
}
|
57 |
|
|
}
|
58 |
|
|
/* MORE ENTRIES ... */
|
59 |
|
|
}
|
60 |
|
|
</pre>
|
61 |
|
|
</div>
|
62 |
|
|
</div>
|
63 |
|
|
|
64 |
|
|
<h2 id="demos">Demos</h2>
|
65 |
|
|
<div class="panel">
|
66 |
|
|
|
67 |
|
|
<h3>Using the contextmenu</h3>
|
68 |
|
|
<div id="demo1" class="demo">
|
69 |
|
|
<ul>
|
70 |
|
|
<li id="phtml_1">
|
71 |
|
|
<a href="#">Root node 1</a>
|
72 |
|
|
<ul>
|
73 |
|
|
<li id="phtml_2">
|
74 |
|
|
<a href="#">Child node 1</a>
|
75 |
|
|
</li>
|
76 |
|
|
<li id="phtml_3">
|
77 |
|
|
<a href="#">Child node 2</a>
|
78 |
|
|
</li>
|
79 |
|
|
</ul>
|
80 |
|
|
</li>
|
81 |
|
|
<li id="phtml_4">
|
82 |
|
|
<a href="#">Root node 2</a>
|
83 |
|
|
</li>
|
84 |
|
|
</ul>
|
85 |
|
|
</div>
|
86 |
|
|
<script type="text/javascript" class="source">
|
87 |
|
|
$(function () {
|
88 |
|
|
$("#demo1").jstree({
|
89 |
|
|
"plugins" : [ "themes", "html_data", "ui", "crrm", "contextmenu" ]
|
90 |
|
|
});
|
91 |
|
|
});
|
92 |
|
|
</script>
|
93 |
|
|
|
94 |
|
|
</div>
|
95 |
|
|
|
96 |
|
|
<h2 id="api">API</h2>
|
97 |
|
|
<div class="panel api">
|
98 |
|
|
|
99 |
|
|
<h3 id="show_contextmenu">.show_contextmenu ( node , x, y )</h3>
|
100 |
|
|
<p>Shows the contextmenu next to a node. Triggered automatically when right-clicking a node.</p>
|
101 |
|
|
<ul class="arguments">
|
102 |
|
|
<li>
|
103 |
|
|
<code class="tp">mixed</code> <strong>node</strong>
|
104 |
|
|
<p>This can be a DOM node, jQuery node or selector pointing to an element within the tree.</p>
|
105 |
|
|
</li>
|
106 |
|
|
<li>
|
107 |
|
|
<code class="tp">number</code> <strong>x</strong>
|
108 |
|
|
<p>The X-coordinate to show the menu at - may be overwritten by <code>show_at_node</code>. If you omit this the menu is shown aligned with the left of the node.</p>
|
109 |
|
|
</li>
|
110 |
|
|
<li>
|
111 |
|
|
<code class="tp">number</code> <strong>y</strong>
|
112 |
|
|
<p>The Y-coordinate to show the menu at - may be overwritten by <code>show_at_node</code>. If you omit this the menu is shown just below the node.</p>
|
113 |
|
|
</li>
|
114 |
|
|
</ul>
|
115 |
|
|
|
116 |
|
|
</div>
|
117 |
|
|
|
118 |
|
|
</div>
|
119 |
|
|
</body>
|
120 |
|
|
</html>
|