Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9233367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:32:14+00:00 2026-06-18T06:32:14+00:00

One : I need a table with sortable rows (see jqueryui.com). Typically, the examples

  • 0

One: I need a table with sortable rows (see jqueryui.com). Typically, the examples give you list items but it is very possible to do this with table rows. Here’s my homework http://www.foliotek.com/devblog/make-table-rows-sortable-using-jquery-ui-sortable/ and his jsfiddle: http://jsfiddle.net/bgrins/tzYbU/ He basically explains the fixes that go along with making table rows sortable.

Two: I need these sortable table rows to have a modal pop up on hover. It seems I can only have one or the other. Either the sortable rows move, but the pop up doesn’t work (http://jsfiddle.net/anschwem/gAmnQ/2/ it’s sorting/dragging on my end but not the fiddle) or the modal pop ups work and and sort, but it’s list items. (http://jsfiddle.net/anschwem/gAmnQ/1/). Then there’s the strange occurrence where a row is kicked out of the table and only it’s hover works (http://jsfiddle.net/anschwem/gAmnQ/2/). Anyways, I need rows due to correct spacing and the fact that I will also need to dynamically create new rows. Any ideas?

Here’s the HTML for my sortable table:

<table class="table_177" id="sortable2" class="connectedSortable inputboxes">
<thead>
  <tr>
    <th>Vessel Name</th>
    <th>Hull/IMO No.</th>
  </tr>
</thead>  
  <tr>
    <a class="productsModal1" style="text-decoration:none">
    <td class="ui-state-highlight" style="border-right:none">SS Mary Mae</td>
    <td class="ui-state-highlight" style="border-left:none">12345</td></a>
  </tr>      
  <tr>
    <a class="productsModal1" style="text-decoration:none">
    <td class="ui-state-highlight" style="border-right:none">EMS 234</td>
    <td class="ui-state-highlight" style="border-left:none">12346</td></a>
  </tr> 
</table>

The HTML and CSS for my hidden modals:

<style>
div.productsModal1
{
    display:none;
    position:absolute;
    border:solid 1px black;
    padding:8px;
    background-color:white;
}
a.productsModal1:hover + div.productsModal1
{
    display:block;
/*  animation:fade-out .5s 1;
    animation-transition-property: opacity;*/
}
div.productsModal1:hover
{
    display:block;
/*  animation:fade-out .5s 1;
    animation-transition-property: opacity;*/
}
</style>
    <div class="productsModal1" style="top: 230px; left: 320px; z-index:9999" >
  <table id="menu1">
    <tr>
      <th>Vessel Name</th>
      <th>Vessel Type</th>
      <th>Hull/IMO No.</th>
    </tr>
    <tr>
      <td>SS Mary Mae</td>
      <td>Barge</td>
      <td>12345</td>
    </tr>
  </table>
  </div>
  <div class="productsModal1" style="top: 230px; left: 320px; z-index:9999" >
  <table id="menu1">
    <tr>
      <th>Vessel Name</th>
      <th>Vessel Type</th>
      <th>Hull/IMO No.</th>
    </tr>
    <tr>
      <td>EMS 234</td>
      <td>Barge</td>
      <td>67891</td>
    </tr>
  </table>
  </div>

AND my code:

$(window).load(function(){
// Return a helper with preserved width of cells
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;
};
    $("#sortable2 tbody").sortable({helper: fixHelperModified}).disableSelection();
});//]]> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:32:16+00:00Added an answer on June 18, 2026 at 6:32 am
    • First of all, remove the anchor tags wrapping the td because that is invalid HTML.. and add the class to your tr, also use the data-index to store the default index since you will be moving them around and need a way to relate them to the modal

    Change the tr to this

    <tr class="productsModal1" data-index=0>
      <td class="ui-state-highlight" style="border-right:none">SS Mary Mae</td>
      <td class="ui-state-highlight" style="border-left:none">12345</td>
    </tr>
    <tr class="productsModal1" data-index=1>
      <td class="ui-state-highlight" style="border-right:none">EMS 234</td>
      <td class="ui-state-highlight" style="border-left:none">12346</td>
    </tr>
    
    • Not sure why $(window).load function wasn’t working.. but using document.ready function fixed the fiddle of sorting not working..

    • You can then use jQuery to show/hide the relevant divs

    JS

    $('#sortable2 tbody tr').on({
        mouseenter: function () {
          $('div.' + $(this).attr('class')) // <-- this gets the div.. though the share the same class so can probably just hardcode
                .eq($(this).data('index')) // <-- gets the correct one according to data-index
                .show();
        },
        mouseleave: function () {
          $('div.' + $(this).attr('class'))
                .eq($(this).data('index'))
                .hide();
        }
    });
    

    FIDDLE

    One other thing is if you don’t want to go in and hardcode the data attributes. You can just write use jQuery inside the document.ready function and dynamically add it.

    $('#sortable2 tbody tr').each(function(i,v){
         $(this).data('index',i);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need one cell that will contains sum of all items from another table.
I have 3 column table, I will need one of the columns to give
I need a table that stores key-value pairs, so I created one with a
I need to copy a table from one server to another.for that I have
I need to select multiple table and one of it is transposed, my table
I need to select data from one table and insert it into another table.
I need to duplicate one row changing the PK. The table can be different
I have one table TABLE_EXAM . i need to update the value of specific
I have one table TABLE_QUESTION. I need to fetch record by passing exam_id and
I have one table TABLE_SUBJECT which contain a number of subjects. I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.