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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:39:16+00:00 2026-05-26T23:39:16+00:00

I have a sortable like the 2nd example on this page: http://jqueryui.com/demos/sortable/items.html The sortable

  • 0

I have a sortable like the 2nd example on this page:

http://jqueryui.com/demos/sortable/items.html

The sortable is a mix of targets:

  • Those that can be picked up and rearranged
  • Disabled items, which cannot be picked up (but are drop targets).

The problem is in the way the component interprets my intention on sorting. As an example picking up the first element of the following list and dragging it to the fourth position will look like this:

A B C X X ==> B C X A X

Here the X’s denote the disabled items.

In my application I would like the sorting behaviour to be different. When a target is picked up and placed over a disabled item (an X) then the list should not shift along to accomodate the target, but instead the target and the disabled item should swap positions.

Using the same example as before (drag from 1st to 4th):

A B C X X ==> X B C A X

If the drop target is normal (ie not disabled) the behaviour should be the same as before (drag from 1st to 3rd):

A B C X X ==> B C A X X

Think of it like wanting to re-arrange appointments on a calendar, when you pick one up from a date and drop it on an empty date, you wouldn’t want the other appointments to shuffle along by one day.

  • 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-26T23:39:16+00:00Added an answer on May 26, 2026 at 11:39 pm

    I’ve put together a jsfiddle with your desired functionality.

    Basically I tie into the change function of sortable and I check to see if the element the helper just passed over is disabled. If it is then I move that element to where the helper started from.

    Here is the jsfiddle http://jsfiddle.net/YjhzR/3/

    Hope this helps!

    Update:

    http://jsfiddle.net/YjhzR/6/

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

Sidebar

Related Questions

I have a sortable list like this one: http://jqueryui.com/demos/sortable Is it possible to get
I have been looking at http://jqueryui.com/demos/sortable/#default most of the day. I would imaging updating
I have a selector like this: $list = $('ul.sortable'); for jQueryUI's sortable plugin. There
I have some XML like this: <root> <do-not-sort> <z/> <y/> </do-not-sort> <sortable> <e f=fog
Nearly have this working but... the javascript calls django like this: .sortable({ connectWith: '.object',
I am using jQuery Sortable. I have the HTML setup like so: <ul id='plan'>
In my page I have a sortable. At current I have some code like
I have some markup like this (classes are just for explication): <ol id=root class=sortable>
I have a list of elements which I would like to make sortable and
I have a query sortable collection of images, ie. the items is set 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.