ref: master
plugins/display_content/public/javascripts/jstree-v.pre1.0/_docs/crrm.html
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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
<!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 - CRRM 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>crrm plugin</h1> <h2>Description</h2> <div id="description"> <p>The <code>CRRM</code> plugin handles creating, renaming, removing and moving nodes by the user.</p> </div> <h2 id="configuration">Configuration</h2> <div class="panel configuration"> <h3>input_width_limit</h3> <p class="meta">A number. Default is <code>200</code>.</p> <p>When renaming (or creating) nodes the input for the text will autosize - this number sets the maximum size for the input.</p> <h3>move</h3> <p class="meta">An object, containing various settings - see below for more.</p> <h3>move.always_copy</h3> <p class="meta"><code>true</code>, <code>false</code> or <code>"multitree"</code>. Default is <code>false</code>.</p> <p>Defines how moves are handled - if set to <code>true</code> every move will be forced to a copy (leaving the original node in place). If set to <code>"multitree"</code> only moves between trees will be forced to a copy.</p> <h3>move.open_onmove</h3> <p class="meta">A Boolean. Default is <code>true</code>.</p> <p>If set to true, when moving a node to a new, closed parent, the parent node will be opened when the move completes.</p> <h3>move.default_position</h3> <p class="meta">A string or a number. Default is <code>"last"</code>.</p> <p>The default position to move to if no position is specified. This can be a zero based index to position the element at a specific point among the new parent's current children. You can also use one of these strings: <code>"before"</code>, <code>"after"</code>, <code>"inside"</code>, <code>"first"</code>, <code>"last"</code>.</p> <h3>move.check_move</h3> <p class="meta">A function. Default is <code>function (m) { return true; }</code>.</p> <p>The callback function enabling you to prevent some moves - just return <code>false</code>. The <code>m</code> parameter is the move object generated by jstree. The object follows the structure described in <a href="core.html#_get_move">._get_move</a>.</p> </div> <h2 id="demos">Demos</h2> <div class="panel"> <h3>Creating nodes</h3> <input type="button" class="button" value="create_1" id="create_1" style="float:left;" /> <input type="button" class="button" value="create_2" id="create_2" style="float:left;" /> <input type="button" class="button" value="create_3" id="create_3" style="" /> <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 () { $("#create_1").click(function () { $("#demo1").jstree("create"); }); $("#create_2").click(function () { $("#demo1").jstree("create","#phtml_1","first","Enter a new name"); }); $("#create_3").click(function () { $("#demo1").jstree("create",-1,false,"No rename",false,true); }); $("#demo1").jstree({ "ui" : { "initially_select" : [ "phtml_2" ] }, "core" : { "initially_open" : [ "phtml_1" ] }, "plugins" : [ "themes", "html_data", "ui", "crrm" ] }); }); </script> <h3>Removing nodes</h3> <input type="button" class="button" value="remove_1" id="remove_1" style="float:left;" /> <input type="button" class="button" value="remove_2" id="remove_2" style="" /> <div id="demo2" class="demo"> <ul> <li id="rhtml_1"> <a href="#">Root node 1</a> <ul> <li id="rhtml_2"> <a href="#">Child node 1</a> </li> <li id="rhtml_3"> <a href="#">Child node 2</a> </li> </ul> </li> <li id="rhtml_4"> <a href="#">Root node 2</a> </li> </ul> </div> <script type="text/javascript" class="source"> $(function () { $("#remove_1").click(function () { $("#demo2").jstree("remove"); }); $("#remove_2").click(function () { $("#demo2").jstree("remove","#rhtml_1"); }); $("#demo2").jstree({ "ui" : { "initially_select" : [ "rhtml_2" ] }, "core" : { "initially_open" : [ "rhtml_1" ] }, "plugins" : [ "themes", "html_data", "ui", "crrm" ] }); }); </script> <h3>Renaming nodes</h3> <input type="button" class="button" value="rename_1" id="rename_1" style="float:left;" /> <input type="button" class="button" value="rename_2" id="rename_2" style="" /> <div id="demo3" class="demo"> <ul> <li id="shtml_1"> <a href="#">Root node 1</a> <ul> <li id="shtml_2"> <a href="#">Child node 1</a> </li> <li id="shtml_3"> <a href="#">Child node 2</a> </li> </ul> </li> <li id="shtml_4"> <a href="#">Root node 2</a> </li> </ul> </div> <script type="text/javascript" class="source"> $(function () { $("#rename_1").click(function () { $("#demo3").jstree("rename"); }); $("#rename_2").click(function () { $("#demo3").jstree("rename","#shtml_1"); }); $("#demo3").jstree({ "ui" : { "initially_select" : [ "shtml_2" ] }, "core" : { "initially_open" : [ "shtml_1" ] }, "plugins" : [ "themes", "html_data", "ui", "crrm" ] }); }); </script> <h3>Moving nodes</h3> <p><strong>move_1</strong> uses the default position - <code>"first"</code></p> <p><strong>move_2</strong> specifies a position - <code>"before"</code> - meaning that the node specified as a first argument will come above the node specified as the second argument</p> <p><strong>move_3</strong> will never work, because of the specified <code>check_move</code> function which prevents the first root node from being moved</p> <input type="button" class="button" value="move_1" id="move_1" style="float:left;" /> <input type="button" class="button" value="move_2" id="move_2" style="float:left;" /> <input type="button" class="button" value="move_3" id="move_3" style="" /> <div id="demo4" class="demo"> <ul> <li id="thtml_1"> <a href="#">Root node 1</a> <ul> <li id="thtml_2"> <a href="#">Child node 1</a> </li> <li id="thtml_3"> <a href="#">Child node 2</a> </li> </ul> </li> <li id="thtml_4"> <a href="#">Root node 2</a> </li> </ul> </div> <script type="text/javascript" class="source"> $(function () { $("#move_1").click(function () { $("#demo4").jstree("move_node","#thtml_4","#thtml_1"); }); $("#move_2").click(function () { $("#demo4").jstree("move_node","#thtml_4","#thtml_1", "before"); }); $("#move_3").click(function () { $("#demo4").jstree("move_node","#thtml_1","#thtml_4"); }); $("#demo4").jstree({ "crrm" : { "move" : { "default_position" : "first", "check_move" : function (m) { return (m.o[0].id === "thtml_1") ? false : true; } } }, "ui" : { "initially_select" : [ "thtml_2" ] }, "core" : { "initially_open" : [ "thtml_1" ] }, "plugins" : [ "themes", "html_data", "ui", "crrm" ] }); }); </script> </div> <h2 id="api">API</h2> <div class="panel api"> <h3 id="_show_input">._show_input ( node , callback )</h3> <p>Renders an input field in a node. Used only internally.</p> <h3 id="rename">.rename ( node )</h3> <p>Sets a node in rename mode and when the user has entered changes, an event is triggered.</p> <ul class="arguments"> <li> <code class="tp">mixed</code> <strong>node</strong> <p>This can be a DOM node, jQuery node or selector pointing to an element within the tree. If you use the UI plugin - pass <code>null</code> to use the currently selected item.</p> </li> </ul> <h3 id="create">.create ( node , position , js , callback , skip_rename )</h3> <p>Creates a new node. Triggers an event.</p> <ul class="arguments"> <li> <code class="tp">mixed</code> <strong>node</strong> <p>This can be a DOM node, jQuery node or selector pointing to the element you want to create in (or next to). If you use the UI plugin - pass <code>null</code> to use the currently selected item.</p> </li> <li> <code class="tp">mixed</code> <strong>position</strong> <p>The position of the newly created node. This can be a zero based index to position the element at a specific point among the current children. You can also pass in one of those strings: <code>"before"</code>, <code>"after"</code>, <code>"inside"</code>, <code>"first"</code>, <code>"last"</code>.</p> </li> <li> <code class="tp">object</code> <strong>js</strong> <p>The data for the newly created node. Consists of three keys:</p><p style="margin-left:25px;"><code class="tp">attr</code> - an object of attributes (same used for <code>jQuery.attr()</code>. You can omit this key;<br /><code class="tp">state</code> - a string - either <code>"open"</code> or <code>"closed"</code>, for a leaf node - omit this key;<br /><code class="tp">data</code> - a string or an object - if a string is passed it is used for the title of the node, if an object is passed there are two keys you can specify: <code>attr</code> and <code>title</code>;</p> </li> <li> <code class="tp">function</code> <strong>callback</strong> <p>A function to be executed once the node is created. You'd be better off waiting for the event.</p> </li> <li> <code class="tp">bool</code> <strong>skip_rename</strong> <p>Skips the user input step. The node is created with the data you have supplied.</p> </li> </ul> <h3 id="remove">.remove ( node )</h3> <p>Removes a node. Triggers an event.</p> <ul class="arguments"> <li> <code class="tp">mixed</code> <strong>node</strong> <p>This can be a DOM node, jQuery node or selector pointing to an element within the tree. If you use the UI plugin - pass <code>null</code> to use the currently selected items.</p> </li> </ul> <div style="height:1px; visibility:hidden; overflow:hidden;"><span id="check_move"> </span></div> <h3 id="move_node">.check_move ( ), .move_node ( )</h3> <p>Both functions are overwritten from the <a href="core.html#check_move">core</a> in order to implement the new functionality.</p> <h3 id="cut">.cut ( node )</h3> <p>Cuts a node (prepares it for pasting).</p> <ul class="arguments"> <li> <code class="tp">mixed</code> <strong>node</strong> <p>This can be a DOM node, jQuery node or selector pointing to an element within the tree. If you use the UI plugin - pass <code>null</code> to use the currently selected item.</p> </li> </ul> <h3 id="copy">.copy ( node )</h3> <p>Copies a node (prepares it for pasting).</p> <ul class="arguments"> <li> <code class="tp">mixed</code> <strong>node</strong> <p>This can be a DOM node, jQuery node or selector pointing to an element within the tree. If you use the UI plugin - pass <code>null</code> to use the currently selected item.</p> </li> </ul> <h3 id="paste">.paste ( node )</h3> <p>Pastes copied or cut nodes inside a node.</p> <ul class="arguments"> <li> <code class="tp">mixed</code> <strong>node</strong> <p>This can be a DOM node, jQuery node or selector pointing to an element within the tree. If you use the UI plugin - pass <code>null</code> to use the currently selected item.</p> </li> </ul> </div> </div> </body> </html> |