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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:16:43+00:00 2026-06-11T08:16:43+00:00

JQuery UI Sortable works great for lists with no gaps, but say I want

  • 0

JQuery UI Sortable works great for lists with no gaps, but say I want to render a list of items with gaps, e.g.

1, 2, empty, 4, 5, 6, empty, 8

where the number represents the slot number. The behavior expected then would be if the user drags an element over the 2 slot, the 2 value gets pushed to the empty slot 3, and the user could drop the new element in the 2 slot, whereas if they drag a new element over the empty 3 slot, the list items would not push down, and the user could just drop the new item into the empty 3 slot. Hopefully this makes sense.

I’ve been looking at the JQuery UI Sortable code, and it seems that I need to utilize the change and receive callbacks in order to achieve this, but, being new to JQuery/JS in general, it’s not clear to me what to use to add these empty slot placeholders and manage the selection list so that I don’t break the sorting functionality with custom code.

Any pointers, examples, etc. would be much appreciated.

After banging my head on this for a while, I created a jsFiddle: http://jsfiddle.net/pdHnX/

To help explain the problem. I believe everything I’m trying to accomplish can happen in an overridden _rearrange method. The fiddle code handles the case where an item is replacing a filler item, but there is an odd issue, where if you drag an item from the item list to the filler list, drop the item, then drag the same item within the filler list, the filler list is shrunk by 1, which is a problem.

There are more issues once you start dragging more items into the filler list, but this is where I’m at with the problem at the moment.

  • 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-11T08:16:44+00:00Added an answer on June 11, 2026 at 8:16 am

    Sorry, this was a really difficult question to detail out. The requirements were really specific and hard to describe.

    Here is the solution I was looking for.

    The others answers here, while they may have been solutions to the poorly described problem, were not what I was looking for.

    http://jsfiddle.net/vfezJ/

    Unfortunately, the sortable.js code is very hairy so the code linked there is also very hairy. The solution I’ve posted also makes some assumptions on CSS classes and DOM ids to get the job done.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got 3 UL lists that are using sortable jquery.ui. All works great, but
Im using jquery sortable and connected lists that works great. I have two lists,
I'm working with a demo of two sortable jquery lists... but have a problem
I'm trying to use jQuery UI's sortable to make list items in a browser
I am trying to use sortable, a jQuery plugin and while it works great
I'm using jQueryUI to create a sortable list, and the UI part works great
I'm building a jQuery sortable list where the user can add items from a
I'm using jQuery UI sortable plugin to be able to select and sort items.
I using jquery sorting ( http://jqueryui.com/demos/sortable/ ). Is it possible to sort (move list)
I'm using jQuery UI's sortable list to allow the user to drag and change

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.