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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:54:21+00:00 2026-05-15T08:54:21+00:00

I have a sortable list (of tasks). It helps prioritize tasks, so I want

  • 0

I have a sortable list (of tasks). It helps prioritize tasks, so I want to keep this functionality. Now I want to add subtasks to the functionality: I want to enable users to drag one task over to another task and drop it there to turn it into a subtask.

Applying .draggable() and .droppable() to items that are already sortable has no effect. What could I do?

  • 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-15T08:54:22+00:00Added an answer on May 15, 2026 at 8:54 am

    I put together a demo of how to do this… but it may not be the best method. Here are some problems I’ve discovered:

    • Because this code uses the placeholder to figure out where you are moving the list, you can only drop an item inside another item if you approach it from the top. I did get a working version where you could drop an item anywhere inside the base item, but the code was just too messy and cumbersome.
    • Sometimes when an item from the other list is dropped in an item, it becomes stuck. I’m not sure why, but it becomes unstuck when the list group is moved to the other list.

    I’m sure there is a better method, one that calculates the intersection of list items (just like the sortable script does). But this is a quick and dirty method.

    $(function() {
        var phTop, container, indx;
        $("#sortable1, #sortable2").sortable({
            connectWith: '.connectedSortable',
            beforeStop: function(e,ui){
                phTop = ui.placeholder.position().top;
                container = ui.placeholder.parent();
                indx = ui.placeholder.index();
            },
            stop: function(e,ui){
                var list = container.find('> li').eq(indx);
                // 15 is a pixel tolerance between the two items (dragging in from the top)
                if ( Math.abs( phTop - ui.position.top ) < 15 ) {
                    // prevent list depth > 1
                    if (ui.item.find('li').length > 0) { return; }
                    // add ul inside of li to make subgroup
                    if (!list.find('ul').length) { list.append('<ul></ul>'); }
                    ui.item.appendTo( list.find('> ul') );
                }
                container.find('li > ul:empty').remove(); // remove empty subgroups
            }
        }).disableSelection();
    });
    
    • 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
Let's say I have a sortable list like this: $(.song-list).sortable({ handle : '.pos_handle', axis
I have a sortable that it was loaded from JSON files. Now I want
In my rails app, I want to have a sortable list as part of
Im using this .sortable function on my list. My problem is that I want
I have connected sortable list and I want to have a callback function for
I have built a sortable list using jQuery UI's sortable feature, this is working
I have been working on a sortable list. I want to implement a sortable
I have a sortable list and a draggable div: <div id=draggable>Add Item</div> <ul id=sortable>
I have a jQuery sortable list - and simply put I want to delete

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.