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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:26:44+00:00 2026-06-02T16:26:44+00:00

I’m expecting sortout’ event to fire when the dragging portal leaves the column. The

  • 0

I’m expecting “sortout’ event to fire when the dragging portal leaves the column. The ‘sortover’ event fires as expected.. I’m not sure if this is the way it should work or jquery UI is broken.

Here is the demo code http://jsfiddle.net/kY7SV/6/ Drag all the portlets out of the column and it should collapse. Drag portlets over the collapsed column, and it should expand.

Help is appreciated

Edit for Merlyn the important bits:

<ul id="sm" class="sm">
    <li id=list1><div style="background-color:red">1</div>
        <div class="column" id='col1'>
            <div class="portlet">
                <div class="portlet-header">Feeds</div>
                <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
            </div>
            <div class="portlet">
                <div class="portlet-header">News</div>
                <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
            </div>
        </div>
    </li>
    <li id=list2><div style="background-color:yellow">2</div>
        <div class="column" id='col2'>
            <div class="portlet">
                <div class="portlet-header">Shopping</div>
                <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
            </div>
            <div class="portlet">
                <div class="portlet-header">Messages</div>
                <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
            </div>
        </div>
    </li>
    <li id=list3><div style="background-color:blue">3</div>
        <div class="column" id='col3'>
            <div class="portlet">
                <div class="portlet-header">Links</div>
                <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
            </div>
            <div class="portlet">
                <div class="portlet-header">iMAGES</div>
                <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
            </div>
        </div>
    </li>
</ul>
​
$(function() {
    $(".column").sortable({
        connectWith: ".column"
    });

    $(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all").find(".portlet-header").addClass("ui-widget-header ui-corner-all").prepend("<span class='ui-icon ui-icon-minusthick'></span>").end().find(".portlet-content");

    $(".portlet-header .ui-icon").click(function() {
        $(this).toggleClass("ui-icon-minusthick").toggleClass("ui-icon-plusthick");
        $(this).parents(".portlet:first").find(".portlet-content").toggle();
    });

    $(".column").disableSelection();

    $(".column").bind("sortremove", function(event, ui) {
        var listitem = $(this).parents('li');
        var cnt = $(this).children().length;
        if (cnt < 1) {
            $(listitem).css('maxWidth', '25px');
        }
    });

    $(".column").bind("sortover", function(event, ui) {
        var listitem = $(this).parents('li');
        $(listitem).css('maxWidth', '');
    });

    $(".column").bind("sortout", function(event, ui) {
        var listitem = $(this).parents('li');
        var cnt = $(this).children().length;
        if (cnt < 1) {
            $(listitem).css('maxWidth', '25px');
        }
    });

    $(".column").bind("sortreceive", function(event, ui) {
        var listitem = $(this).parents('li');
        $(listitem).css('maxWidth', '');
    });

});​
  • 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-02T16:26:45+00:00Added an answer on June 2, 2026 at 4:26 pm

    Problem

    The problem is that you’re selecting the wrong items. The li always contains exactly two children: The text div, and the container div. It doesn’t directly contain your items.

    ui.sender seems to give the source li directly, though. You could call $(ui.sender).children().count to get the count of the column you are dragging out of.

    The child count during the out event will always be 1 or more while doing the drag, and only when the drop fires will the count be 0. This probably has to do with the timing of when the event fires, or the fact that it might leave some sort of placeholder element while doing the dragging.

    Suggested Solution

    I recommend rethinking the demo, at least in regards to the out event. It is tricky logic to determine when you’re still dragging and when you’ve finished dragging from inside that out event. It also is good UI design to leave a large drop-target while you’re dragging things around.

    The remove and receive events have a much more obvious count. I’d stick with resizing on those events.

    How I figured this out

    I opened my javascript console (F12 in your browser), and inserted a console write statement inside the out event. On chrome, this is console.out(...item to log here...). I toyed around with the various objects available to me (this, event, ui), and checked the outerHTML on their various HTML element properties.

    Once you figured out how to select the right element, a simple way to figure out the count part of the problem would be to update the text of an element with the current child count. Then you’d see it update in real-time, per-column. I was logging, and noticed it was permanently stuck at 2, which clued me in to the fact that the wrong element was selected.

    Notes

    I can’t figure out what all the properties on this are supposed to be, and they seemed to change over time. The documentation isn’t much help. If I knew more about javascript events (in general) that might have helped me figure it out 🙂

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
I need a function that will clean a strings' special characters. I do NOT
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on

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.