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 5940359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:57:25+00:00 2026-05-22T15:57:25+00:00

Having two lists [A,B,C,D] and [1,2,3,4] , I want to provide a user interface

  • 0

Having two lists[A,B,C,D] and [1,2,3,4], I want to provide a user interface for merging them into a new list. In the new list the original order of each list should be maintained. For example any of [A,1,B,2,C,3,D,4]or [A,B,C,D,1,2,3,4]or [A,B,1,C,2,3,4,D]are OK. But [B,A,1,2,3,4,C,D] is not accepted, due to B coming before A.

jQuery UI sortable seems to be a good starting point. But maintaining the original order is not supported (Of course the meaning of sortable is in contrast with my requirement. But the user interface supported with sortable, is very similar to my final goal.)

I think handling receive event and canceling the sort when the order is not maintained, could be the solution. But could not found how to cancel or undo the drag, when receive is complete.

Thanks in advance

  • 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-05-22T15:57:26+00:00Added an answer on May 22, 2026 at 3:57 pm

    you are right. jquery’s sortable will do the trick.

    start with using a helper

    $( ".selector" ).sortable({ helper: 'clone' });
    

    this won’t drag the item itself but a cloned replica.

    next you can use the event “beforeStop” to check the previous and next item.

    $( ".selector" ).sortable({ 
         helper: 'clone',
         beforeStop: function(event, ui) { ... }
     });
    

    remember that the appendTo and prependTo and insertAfter and insertBefore function are moving a dom element rather than cloning it. This means this code is valid for playing with the li elements.

    html:

    <ul>
    <li class='i-1'>first</li>
    <li class='i-2'>second</li>
    <li class='i-3'>third</li>
    <li class='i-4'>fourth</li>
    </ul>
    

    jquery:

    $('li').eq(3).insertBefore('li.i-1');
    

    result:

    <ul>
    <li class='i-4'>fourth</li>
    <li class='i-1'>first</li>
    <li class='i-2'>second</li>
    <li class='i-3'>third</li>
    </ul>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having two lists, I want to get all the possible couples. (a couple can
I wanna place two child un-ordered lists side by side. They are having Class
Consider two tables transaction and category each having their own ID and information. A
After having looked at each of these two projects, it seems that both are
I am having dependency troubles. I have two classes: Graphic and Image . Each
i am having two list box which perform add remove item functionality which are
EDIT: It seems to be something with having the two queues in the same
I am having trouble integrating two products, one of which is mine and they
I have two third-party libraries occasionally having the same symbol name exported. When the
Having difficulty articulating this correlated subquery. I have two tables fictitious tables, foo and

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.