JSFiddle - React, Tailwind, and code Playground
by Trevor Dowdle
HTML
<div id="allLists">
<span class="list">
<table class="altRow ">
<thead style="display:block;padding:0px">
<tr>
<th style="padding:4px 3px;" width="10">#</th>
<th style="padding:4px 3px;" width="240">Name</th>
</tr>
</thead>
<tbody class="sortable swimTableTbody" style="display:block;min-height: 25px;">
<tr id="row_13666">
<td width="10"> </td>
<td width="240">some content</td>
</tr>
<tr id="row_13666">
<td width="10"> </td>
<td width="240">some content</td>
</tr>
<tr id="row_13666">
<td width="10"> </td>
<td width="240">some content</td>
</tr>
<tr id="row_13666">
<td width="10"> </td>
<td width="240">some content</td>
</tr>
<tr id="row_13666">
<td width="10"> </td>
<td width="240">some content</td>
</tr>
<tr id="row_13666">
<td width="10"> </td>
<td width="240">some content</td>
</tr>
<tr id="row_13666">
<td width="10"> </td>
<td width="240">some content</td>
</tr>
<tr id="row_13666">
<td width="10"> </td>
<td width="240">some content</td>
</tr>
</tbody>
</table>
</span>
<span class="list">
<table class="altRow ">
<thead style="display:block;padding:0px">
<tr>
<th style="padding:4px 3px;" width="10">#</th>
<th style="padding:4px 3px;" width="240">Name</th>
</tr>
</thead>
<tbody class="sortable swimTableTbody" style="display:block;min-height: 25px;">
<tr id="row_13666">
<td width="10"> </td>
<td width="240">some content</td>
</tr>
<tr id="row_13666">
<td width="10"> </td>
<td width="240">some content</td>
</tr>
<tr id="row_13666">
<td...
CSS
#allLists {
bottom: 12px;
left: 0;
position: absolute;
right: 0;
top: 10px;
white-space: nowrap;
}
.swimTableTbody {
display: block;
overflow: auto; //this is what allows me to have vertical scroll bars on long tables
width: 100%;
height: 150px;
}
.list {
display: inline-block;
width: 300px;
top: 80px;
position: relative;
}
JavaScript
$(".sortable").sortable({
connectWith: ".sortable",
placeholder: "ui-state-highlight",
scroll: true,
helper: function(e, tr)
{
var $originals = tr.children();
var $helper = tr.clone();
$helper.children().each(function(index)
{
$(this).width($originals.eq(index).width());
});
$helper.css("background-color", "rgb(223, 240, 249)");
return $helper;
}
});
$("#sortable").disableSelection();