I have a conflict when trying to mix those plugins, i have based my script in some demos. The problem is that when i drag something inside the same list it triggers the drop event and that item is added to the end of the list, wich is correct if the item is dropped in another list, but not in the same, when i drop it in the same list i want to insert it in that position (it works if i disable the drop event)
js code:
$(document).ready(function() {
$("#sortlist1").treeview();
$("#sortlist1").droppable({
accept: ".item",
drop: function(ev, ui) {
alert(ui.sender)
$("#sortlist1").append($(ui.draggable));
}
});
$("#sortlist2").droppable({
accept: ".item",
drop: function(ev, ui) {
$("#sortlist2").append($(ui.draggable));
}
});
$("#sortlist3").droppable({
accept: ".item",
drop: function(ev, ui) {
$("#sortlist3").append($(ui.draggable));
}
});
$('.sortlist').sortable({
handle : '.icono',
update : function () {
$('input#sortlist').val($('.sortlist').sortable('serialize'));
}
});
});
And html:
<ul class="sortlist treeview lista" id="sortlist1">
<li id="listItem_1" class="expandable closed item">
<div class="hitarea closed-hitarea expandable-hitarea lastExpandable-hitarea">
<img src="img/arrow_out.png" class="icono" alt="move" />
</div>
numero 1<input type="checkbox" />
<ul class="sortlist" id="sublist">
<li id="sublistItem_1"><img src="img/arrow_out.png" class="icono" alt="move" />numero 1<input type="checkbox" /></li>
<li id="sublistItem_2"><img src="img/arrow_out.png" class="icono" alt="move" />numero 2<input type="checkbox" /></li>
</ul>
</li>
<li id="listItem_2" class="item"><img src="img/arrow_out.png" class="icono" alt="move" />numero 2<input type="checkbox" /></li>
<li id="listItem_3" class="item"><img src="img/arrow_out.png" class="icono" alt="move" />numero 3<input type="checkbox" /></li>
<li id="listItem_4" class="item"><img src="img/arrow_out.png" class="icono" alt="move" />numero 4<input type="checkbox" /></li>
<li id="listItem_5" class="item"><img src="img/arrow_out.png" class="icono" alt="move" />numero 5<input type="checkbox" /></li>
<li id="listItem_6" class="item"><img src="img/arrow_out.png" class="icono" alt="move" />numero 6<input type="checkbox" /></li>
<li id="listItem_7" class="item"><img src="img/arrow_out.png" class="icono" alt="move" />numero 7<input type="checkbox" /></li>
<li id="listItem_8" class="item"><img src="img/arrow_out.png" class="icono" alt="move" />numero 8<input type="checkbox" /></li>
<li id="listItem_9" class="item"><img src="img/arrow_out.png" class="icono" alt="move" />numero 9<input type="checkbox" /></li>
<li id="listItem_10" class="item"><img src="img/arrow_out.png" class="icono" alt="move" />numero 10<input type="checkbox" /></li>
<li id="listItem_11" class="item"><img src="img/arrow_out.png" class="icono" alt="move" />numero 11<input type="checkbox" /></li>
</ul>
<ul class="sortlist treeview lista" id="sortlist2">
</ul>
<ul class="sortlist treeview lista" id="sortlist3">
</ul>