silverstripe-framework/thirdparty/jstree/_docs/unique.html

85 lines
2.4 KiB
HTML

<!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 - unique 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>unique plugin</h1>
<h2>Description</h2>
<div id="description">
<p>The <code>unique</code> plugin prevents from nodes with same titles coexisting (create/move/rename) in the same parent.</p>
</div>
<h2 id="configuration">Configuration</h2>
<div class="panel configuration">
<h3>error_callback</h3>
<p class="meta">A function. Default is <code>$.noop</code>.</p>
<p>Whenever the plugin stops an action (because it violates the unique policy) this function will bre triggered in current tree's scope, receiving the name, siblings and function name that caused the conflict.</p>
</div>
<h2 id="demos">Demos</h2>
<div class="panel">
<p>Try moving the child nodes together (drag'n'drop).</p>
<h3>Using the unique plugin</h3>
<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>
</ul>
</li>
<li id="phtml_4">
<a href="#">Root node 2</a>
<ul>
<li id="phtml_3">
<a href="#">Child node 1</a>
</li>
</ul>
</li>
</ul>
</div>
<script type="text/javascript" class="source">
$(function () {
$("#demo1").jstree({
"unique" : {
"error_callback" : function (n, p, f) {
// alert("Duplicate node `" + n + "` with function `" + f + "`!");
}
},
"plugins" : [ "themes", "html_data", "dnd", "unique" ]
});
});
</script>
</div>
<h2 id="api">API</h2>
<div class="panel api">
<h3 id="save_cookie">._check_unique ( names, siblings )</h3>
<p>Used internally - checks the names array against the sibling nodes for matches.</p>
</div>
</div>
</body>
</html>