Note that there are some explanatory texts on larger screens.

plurals
  1. POConflict between Drag and drop and sortable jquery plugins
    primarykey
    data
    text
    <p>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)</p> <p>js code:</p> <pre><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')); } }); }); </code></pre> <p>And html:</p> <pre><code>&lt;ul class="sortlist treeview lista" id="sortlist1"&gt; &lt;li id="listItem_1" class="expandable closed item"&gt; &lt;div class="hitarea closed-hitarea expandable-hitarea lastExpandable-hitarea"&gt; &lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt; &lt;/div&gt; numero 1&lt;input type="checkbox" /&gt; &lt;ul class="sortlist" id="sublist"&gt; &lt;li id="sublistItem_1"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 1&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;li id="sublistItem_2"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 2&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li id="listItem_2" class="item"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 2&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;li id="listItem_3" class="item"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 3&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;li id="listItem_4" class="item"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 4&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;li id="listItem_5" class="item"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 5&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;li id="listItem_6" class="item"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 6&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;li id="listItem_7" class="item"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 7&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;li id="listItem_8" class="item"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 8&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;li id="listItem_9" class="item"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 9&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;li id="listItem_10" class="item"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 10&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;li id="listItem_11" class="item"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 11&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;/ul&gt; &lt;ul class="sortlist treeview lista" id="sortlist2"&gt; &lt;/ul&gt; &lt;ul class="sortlist treeview lista" id="sortlist3"&gt; &lt;/ul&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload