Note that there are some explanatory texts on larger screens.

plurals
  1. POsort in the same table and drop in different table
    primarykey
    data
    text
    <p>I have two tables in my code. I want to sort the rows in with in same table and drag and drop in different table.</p> <p>so I used both sortable and draggable, droppable functions. but only one is working ( depending on using id and classes).</p> <p>I'm new here so I don't know how to give link so I'm pasting my code here in which only drag and drop is working not sorting.</p> <p>here is my script part</p> <pre><code>&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="http://code.jquery.com/ui/1.8.18/jquery-ui.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt;//&lt;![CDATA[ $(window).load(function () { var fixHelperModified = function (e, tr) { var $originals = tr.children(); var $helper = tr.clone(); $helper.children().each(function (index) { $(this).width($originals.eq(index).width()) }); return $helper; }, updateIndex = function (e, ui) { $('td.index', ui.item.parent()).each(function (i) { $(this).html(i + 1); }); }; $(".grid tbody").sortable({ helper: fixHelperModified, stop: updateIndex }).disableSelection(); });//]]&gt; &lt;/script&gt; &lt;script src="http://code.jquery.com/jquery-1.9.1.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(window).load(function () { $("#dragdrop tr, #dragdrop1 tr").draggable({ helper: 'clone', revert: 'invalid', start: function (event, ui) { $(this).css('opacity', '.5'); }, stop: function (event, ui) { $(this).css('opacity', '1'); } }); $("#dragdrop, #dragdrop1").droppable({ drop: function (event, ui) { $(ui.draggable).appendTo(this); //alert($(ui.draggable).text()); //fire ajax here if needed } }); }); &lt;/script&gt; </code></pre> <p>here is my style table{border: brown 1px solid} </p> <p>and head part</p> <pre><code>&lt;h1&gt;Table one&lt;/h1&gt; &lt;table id="dragdrop" class="grid" title="Kurt Vonnegut novels"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th class="index"&gt;No.&lt;/th&gt; &lt;th&gt;Year&lt;/th&gt; &lt;th&gt;Title&lt;/th&gt; &lt;th&gt;Grade&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td class="index"&gt;1&lt;/td&gt; &lt;td&gt;1969&lt;/td&gt; &lt;td&gt;Slaughterhouse-Five&lt;/td&gt; &lt;td&gt;A+&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="index"&gt;2&lt;/td&gt; &lt;td&gt;1952&lt;/td&gt; &lt;td&gt;Player Piano&lt;/td&gt; &lt;td&gt;B&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="index"&gt;3&lt;/td&gt; &lt;td&gt;1963&lt;/td&gt; &lt;td&gt;Cat's Cradle&lt;/td&gt; &lt;td&gt;A+&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="index"&gt;4&lt;/td&gt; &lt;td&gt;1973&lt;/td&gt; &lt;td&gt;Breakfast of Champions&lt;/td&gt; &lt;td&gt;C&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="index"&gt;5&lt;/td&gt; &lt;td&gt;1965&lt;/td&gt; &lt;td&gt;God Bless You, Mr. Rosewater&lt;/td&gt; &lt;td&gt;A&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;h1&gt;Table two&lt;/h1&gt; &lt;table id="dragdrop1" class="grid" title="Kurt Vonnegut novels"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th class="index"&gt;No.&lt;/th&gt; &lt;th&gt;1Year&lt;/th&gt; &lt;th&gt;1Title&lt;/th&gt; &lt;th&gt;1Grade&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td class="index"&gt;1&lt;/td&gt; &lt;td&gt;11969&lt;/td&gt; &lt;td&gt;1Slaughterhouse-Five&lt;/td&gt; &lt;td&gt;1A+&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="index"&gt;2&lt;/td&gt; &lt;td&gt;11952&lt;/td&gt; &lt;td&gt;1Player Piano&lt;/td&gt; &lt;td&gt;1B&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="index"&gt;3&lt;/td&gt; &lt;td&gt;11963&lt;/td&gt; &lt;td&gt;1Cat's Cradle&lt;/td&gt; &lt;td&gt;1A+&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="index"&gt;4&lt;/td&gt; &lt;td&gt;11973&lt;/td&gt; &lt;td&gt;1Breakfast of Champions&lt;/td&gt; &lt;td&gt;1C&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="index"&gt;5&lt;/td&gt; &lt;td&gt;11965&lt;/td&gt; &lt;td&gt;1God Bless You, Mr. Rosewater&lt;/td&gt; &lt;td&gt;1A&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre>
    singulars
    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