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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:47:49+00:00 2026-05-20T09:47:49+00:00

The first part allows you to first drag an element into a sortable div,

  • 0

The first part allows you to first drag an element into a sortable div, which is working fine. I then want to have that div become sortable as well so I can drag new elements (parts) into those.

That part works fine too, except sometimes if you reorder the elements (the darker ones) it wont let you put a part back into it until you either reorder them again, or try and put it in one of the other elements and go back to it.

It’s kind of hard to explain, but here’s a screen-cast: http://screencast.com/t/Ls2ksVY4Q

The demo is at: http://jsfiddle.net/9MXWp/

Here’s the relevant code:

$(document).ready(function() {
    $('#the-grid').sortable({
        tolerance: 'pointer',
        update: function(event, ui) {
            if( $(ui.item).has('.close').length == 0 ) {
                $(ui.item).prepend('<a href="#" class="close" onclick="$(this).parent().remove();">x</a>');
            }

            $('.part-holder', ui.item).sortable({ 
                tolerance: 'pointer',
                update: function(event, ui) {
                    if( $(ui.item).has('.close').length == 0 )
                        $(ui.item).prepend('<a href="#" class="close" onclick="$(this).parent().remove();">x</a>');
                } 
            }); 

        }
    });

    $('#sidebar > ul > li.part').draggable({
        helper: 'clone',
        connectToSortable: '.part-holder',
        addClasses: false
    }); 

    $('.drag-element').draggable({
        revert: 'invalid',
        helper: 'clone',
        connectToSortable: '#the-grid',
        addClasses: false
    });

    $('#update-list').click(updateList);
});

Recipe that seems to duplicate the problem (in FF 3.6):

  1. Drag Element 1 to the staging area.

  2. Drag Element 2 to the staging area; place it before element 1.

  3. Drag a Part inside Element 1.   ☞ Sometimes the page will fail right here. ☜ ☣

  4. Drag a Part inside Element 2.

  5. Now drag Element 2 to be after Element 1.

  6. ☞ Drag a Part inside Element 1; it won’t work. ☜ ☣

  7. Drag a Part inside Element 2; it will work, and now Element 1 accepts parts again.

  • 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-20T09:47:50+00:00Added an answer on May 20, 2026 at 9:47 am

    ok lets try this again; i added a ‘connectWith’ option, then wrapped the ‘.part-holder’ sortable initializer so it doesn’t get updated every time the grid is re-ordered…

    $(document).ready
    (
        function()
        {
            $('#the-grid').sortable
            ( {
                tolerance:  'pointer',
                update:     function (event, ui)
                            {
                                if( $(ui.item).has('.close').length == 0 )
                                {
                                    $(ui.item).prepend('<a href="#" class="close" onclick="$(this).parent().remove();">x<\/a>');
                                }
    
                                if($(ui.item).has('.part-holder.ui-sortable').length == 0)
                                {
                                    $('.part-holder', ui.item).sortable({
                                        tolerance: 'pointer',
                                        connectWith: '.part-holder',
                                        update: function(event, ui) {
                                            if( $(ui.item).has('.close').length == 0 )
                                                $(ui.item).prepend('<a href="#" class="close" onclick="$(this).parent().remove();">x</a>');
                                        }
                                    });
                                }
                                else
                                {
                                    // don't recreate
                                }
                            }
            } );
    
            $('#sidebar > ul > li.part').draggable
            ( {
                helper:             'clone',
                connectToSortable:  '.part-holder',
                addClasses:         false
            } );
    
            $('.drag-element').draggable
            ( {
                revert:             'invalid',
                helper:             'clone',
                connectToSortable:  '#the-grid',
                addClasses:         false
            } );
    
            $('#update-list').click (updateList);
        }
    );
    
    function updateList()
    {
        $('#current-list').empty();
    
        $('#the-grid > li').each( function(index, value) {
                $('#current-list').append('<li>' + $(value).html() + '<\/li>');
        });
    }
    

    with those changes, you are able to add the ‘parts’ to the ‘part-holders’! I did see some intermittent js errors… I have no idea why they appear, but they don’t seem to interfere with the operation of the page when viewed with FF 3.6

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

Sidebar

Related Questions

I have a couple of scripts for which the first part of them looks
I have two .php files which show all contacts in a database, then allows
I have a ratings form that allows individuals to be scored and then placed
I have a form which has two inputs. The first input allows a user
I develop the first part of an Android application that allows to broadcast video
I've read that by standard first part of e-mail is case sensitive, however I've
I'm moving my first stpes in iOS development. I have followed the first part
I have been trying to put together something that allows me to extract points
I ran into my first compiler that changes the lvalue passed to ::delete, but
I have an ASP.NET MVC application with a route that allows searching for stuff

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.