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

  • Home
  • SEARCH
  • 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 8562257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:41:31+00:00 2026-06-11T16:41:31+00:00

So i have a nested jqueryui sortable and a draggable item that i can

  • 0

So i have a nested jqueryui sortable and a draggable item that i can drag a copy into any level sortable.

See jsfiddle here http://jsfiddle.net/rmossuk/JUnA7/4/

  • Product
    • Item1
    • Item2
    • Item3
      • Item5
      • Item6
    • Item4

NewItem

The problem is when i drag the NewItem into the nested sortable ( Item3 ) the receive event gets called 3 times. Once for the product sortable and for some reason twice for the Item3 sortable !!??

I need it so that just the Item3 sortable receive event gets called and not the other 2.

Does anyone know how to do this please??

thanks a lot

  • 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-11T16:41:32+00:00Added an answer on June 11, 2026 at 4:41 pm

    The error is a result of having a div.sortable nested in another div.sortable, so it it fires the sorting twice when you drop in a new element. The workaround I came up with just counts the number of elements added in a particular drop and adds a class called ‘deleteMe’ to the duplicates.

    Then you just call $(“.deleteMe”).remove() at the end of a sort to remove the extras.

    Not ideal, but seems to work for me. http://jsfiddle.net/JUnA7/72/

    $(function() {
        var dropCount=0;
        $(".sortable").sortable({
            connectWith: ".sortable",
            cursor: 'pointer',
            receive: function(event, ui) {
                dropCount=dropCount+1;
                if(dropCount>1)
                    $(ui.item).addClass("deleteMe");
                console.log(dropCount);
            },
            start: function(event, ui) {
                dropCount=0;   
                var placeholders=0;
                $(".ui-sortable-placeholder").each(function(){
                    placeholders=placeholders+1;                
                    if(placeholders>1)
                        $(this).height(0);
                });
            },
            stop: function(event, ui) {
                $(".deleteMe").remove();
                dropCount=0;   
            }
        });
        $(".draggable").draggable({
            handle: ".icon-move",
            connectToSortable: ".sortable",
            appendTo: "body",
            helper: 'clone',
            distance: 30
        });
    });​
    

    UPDATED

    Also, I noticed that the sorting placeholders a duplicated too..so I removed the duplicates by setting their height to 0px.

        start: function(event, ui) {
            dropCount=0;   
            var placeholders=0;
            $(".ui-sortable-placeholder").each(function(){
                placeholders=placeholders+1;                
                if(placeholders>1)
                    $(this).height(0);
            });
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a nested drag and drop list which return json formattet string. I
I have two nested packages that I am calling via fast_cgi. From the first
I have list items in an unordered list that when double clicked, can be
I have nested ul/li's and the problem is that if you add a background
Is that possible WIX Condition to have nested if else? <Condition> <Condition> </Condition> </Condition>
Say I have nested methods a, b, c, d, e on each level we
We have a nested menu within our page where drag and drop is enabled
I have a pretty complex setup of nested sortables I have created a jsfiddle
I have nested ajax calls that are not working in ie7. They work fine
I have nested list of the following form: my_list = [['Some1', '2', '3.6', '4.5',

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.