I have two problem,
This nestedSortable is not working in this code, where's the problem ?
I want to block a user to drag an sub-element to the top level (base), i know the library does not allow it, is there a tweak ?
Here is all my code :
<html>
<head>
<style>
html {
background-color: #eee;
}
body {
color: #333;
background-color: #fff;
font-size: 13px;
font-family: "Helvetica Neue", Corbel, "Nimbus Sans L", Helvetica, Arial, sans-serif;
padding: 2em 4em;
width: 860px;
margin: 0 auto;
}
pre, code {
font-size: 12px;
}
pre {
width: 100%;
overflow: auto;
}
small {
font-size: 90%;
}
small code {
font-size: 11px;
}
.placeholder {
background-color: #cfcfcf;
}
.ui-nestedSortable-error {
background:#fbe3e4;
color:#8a1f11;
}
ul{
margin: 0;
padding: 0;
padding-left: 30px;
}
ul.sortable, ul.sortable ul{
margin: 0 0 0 25px;
padding: 0;
list-style-type: none;
}
ul.sortable {
margin: 4em 0;
}
.sortable li {
margin: 7px 0 0 0;
padding: 0;
}
.sortable li div {
border: 1px solid black;
padding: 3px;
margin: 0;
cursor: move;
}
h1 {
font-size: 2em;
margin-bottom: 0;
}
h2 {
font-size: 1.2em;
font-weight: normal;
font-style: italic;
margin-top: .2em;
margin-bottom: 1.5em;
}
h3 {
font-size: 1em;
margin: 1em 0 .3em;;
}
p, ol, ul, pre, form {
margin-top: 0;
margin-bottom: 1em;
}
dl {
margin: 0;
}
dd {
margin: 0;
padding: 0 0 0 1.5em;
}
code {
background: #e5e5e5;
}
input {
vertical-align: text-bottom;
}
.notice {
color: #c33;
}
</style>
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js' type='text/javascript'/>
<script src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.js' type='text/javascript'/>
<script src='http://mjsarfatti.com/sandbox/nestedSortable/jquery.ui.nestedSortable.js' type='text/javascript'/>
<script type='text/javascript'>
$(document).ready(function(){
$('ul.sortable').nestedSortable({
disableNesting: 'no-nest',
forcePlaceholderSize: true,
handle: 'div',
helper: 'clone',
items: 'li',
maxLevels: 3,
opacity: .6,
placeholder: 'placeholder',
revert: 250,
tabSize: 25,
tolerance: 'pointer',
toleranceElement: '> div'
}); });
</script>
</head>
<body>
<ul class="sortable">
<li id="list_1"><div>Item 1</div> </li>
<li id="list_2"><div>Item 2</div> </li>
<ul>
<li id="list_3"><div>Sub Item 2.1</div> </li>
<li id="list_4"><div>Sub Item 2.2</div> </li>
<li id="list_5"><div>Sub Item 2.3</div> </li>
<li id="list_6"><div>Sub Item 2.4</div> </li>
</ul>
<li id="list_7" class="no-nest"><div>Item 3 (no-nesting)</div> </li>
<li id="list_8" class="no-nest"><div>Item 4 (no-nesting)</div> </li>
<li id="list_9"><div>Item 5</div> </li>
<li id="list_10"><div>Item 6</div> </li>
<ul>
<li id="list_11"><div>Sub Item 6.1</div> </li>
<li id="list_12" class="no-nest"><div>Sub Item 6.2 (no-nesting)</div> </li>
<li id="list_13"><div>Sub Item 6.3</div> </li>
<li id="list_14"><div>Sub Item 6.4</div> </li>
</ul> <li id="list_15"><div>Item 7</div> </li>
<li id="list_16"><div>Item 8</div> </li>
</ul>
</body>
</html>
Thanks ! :)
EDIT : here is a working exemple http://mjsarfatti.com/sandbox/nestedSortable/ If I can only get this work, maybe I could look more for my second point
EDIT 2 : I'Ve changed the library as one of the answer told me, but firefox is hanging and there's un unresponsive script
Here is the fiddle : http://jsfiddle.net/dAwEe/2/
EDIT 3 : Someone have an idea ?
EDIT 4 : http://jsfiddle.net/dAwEe/3/ I've fixed my problem one : The nested sortable js was not well include :S
Now someone have an idea for the problem two ?