Loading ...
Sorry, an error occurred while loading the content.

Re: How to fix "Sortable List" demo to allow dragging into empty list?

Expand Messages
  • wizfrob
    ... I appreciate the help! I want to define my DDTargets first, actually, because my DDProxys are defined dynamically. I could go through a dance of
    Message 1 of 22 , Mar 30, 2007
    • 0 Attachment
      --- In ydn-javascript@yahoogroups.com, Eric Miraglia <miraglia@...> wrote:
      > Note, though, that these events happen in a reliable order based on
      > the order in which you defined your DD instances. If you define your
      > DDTarget � your background/container � last, it will get the
      > onDragDrop event last as well. So you can set a flag in your
      > onDragDrop to identify whether or not a list item was hit. If you
      > get onDragDrop firing on the background without hitting an <li>
      > first, you know that you need to handle this from the background/
      > container element.

      I appreciate the help!

      I want to define my DDTargets first, actually, because my DDProxys are
      defined dynamically. I could go through a dance of unregistering the
      targets then reregistering them each time a new DDProxy is created,
      but I'd prefer not to have to...

      I'll look into the approach of using a flag to remember whether the
      DDProxy was just dragged over a contained element before the target
      got the message, but I'm not sure whether this would work reliably
      with onDragOver messages and unpredictable users.

      I'm curious - what's the reasoning behind sending duplicate messages
      to each DD element behind the one actually being dragged over? If the
      foremost element captures the message and does something with it,
      couldn't the choice be left up to this element whether or not to
      continue to pass the message up the line?

      Or, alternately, is there any way to stop the message propagation, so
      that the containing element won't be given the message?

      Again, thank you for your help!

      - B
    • The Mechanical Ruins
      Hi, Building off the DDList example, it s possible to add a class to your sortable items, letting onDragOver decide if the id was a sortable object or a
      Message 2 of 22 , Mar 30, 2007
      • 0 Attachment
        Hi,

        Building off the DDList example, it's possible to add a class to your
        sortable items, letting onDragOver decide if the id was a sortable
        object or a droppable container (I couldn't find a way to detect the
        dd Type). That would then simplify the onDragOver logic to:

        Is this a list item: if so, hold onto the id, treat like normal DDList

        Is this a target: if so, look at the last list item you dragged over.
        Do an isAncestor check to see if you've changed columns (without
        passing over any list items), and appendChild.

        http://www.felocity.org/media/2007/03/30-sortable_column/ (code is a
        bit large to paste to ML) This is a working example with some
        listeners set up just to resize the 3 columns to the viewport size
        during the drag operation. The only thing I'm really hung up on is a
        better way to detect a DDTarget v the sortable item. Adding a class
        and doing hasClass adds a non-standard property to the config object,
        something I'd rather avoid if at all possible. Has anyone had any
        experience with isTypeOfDD()? It seems like it should fill that last
        missing piece.

        ---
        Jakob Heuser




        --- In ydn-javascript@yahoogroups.com, Eric Miraglia <miraglia@...> wrote:
        >
        > If you define your
        > DDTarget — your background/container — last, it will get the
        > onDragDrop event last as well. So you can set a flag in your
        > onDragDrop to identify whether or not a list item was hit. If you
        > get onDragDrop firing on the background without hitting an <li>
        > first, you know that you need to handle this from the background/
        > container element.
        >
        [snip]example
        >
        >
        > ______________________________________________
        > Eric Miraglia
        > Yahoo! User Interface Library
        >
        >
        >
        > On Mar 30, 2007, at 5:52 AM, wizfrob wrote:
        >
        > >
        > > The core of the problem is that when I drag an item into a DDTarget,
        > > then the DDTarget always gets the onDragOver message even if I'm
        > > actually dragging over one of the DD elements in the target. So, the
        > > target has no way of knowing whether itself is the target of the drop,
        > > or whether one of its elements is.
        > >
        > >
        > >
        >
      • wizfrob
        When I drag a DD item over another DD item that s contained by a DDTarget, why does the DDTarget receive copies of the drag events that are sent to the element
        Message 3 of 22 , Apr 4 6:21 AM
        • 0 Attachment
          When I drag a DD item over another DD item that's contained by a
          DDTarget, why does the DDTarget receive copies of the drag events that
          are sent to the element I'm dragging over?

          This behavior is causing me to have to come up with some ugly
          workarounds, because when the container receives an event I don't know
          whether this is because the user is dragging over it or over something
          in it.

          I'm curious to know the reasoning behind this design decision, and
          what situations are made easier by this double-event behavior.
        • Adam Moore
          ... INTERSECT mode was added in part to handle the issue with stacked items, and it was thought at the time that INTERSECT mode would replace POINT mode. That
          Message 4 of 22 , Apr 4 11:02 AM
          • 0 Attachment
            On Wed, Apr 04, 2007 at 01:21:23PM -0000, wizfrob wrote:
            > When I drag a DD item over another DD item that's contained by a
            > DDTarget, why does the DDTarget receive copies of the drag events that
            > are sent to the element I'm dragging over?

            INTERSECT mode was added in part to handle the issue with stacked items,
            and it was thought at the time that INTERSECT mode would replace POINT
            mode. That didn't turn out to be the case, as many implementations are
            easier to work with in POINT mode. The next release will have have a
            feature to make it easier to work with stacked items in POINT mode.

            > This behavior is causing me to have to come up with some ugly
            > workarounds, because when the container receives an event I don't know
            > whether this is because the user is dragging over it or over something
            > in it.

            If you have to resort to ugly workarounds, submitting a bug report will
            help us address it:

            http://sourceforge.net/tracker/?func=add&group_id=165715&atid=836476

            -Adam
          • wizfrob
            ... I d be happy to submit a bug report (and, in fact, I previously did: (bug 1685149, which was closed because the behavior in question was as designed), but
            Message 5 of 22 , Apr 5 5:50 AM
            • 0 Attachment
              --- In ydn-javascript@yahoogroups.com, Adam Moore <adamoore@...> wrote:
              > If you have to resort to ugly workarounds, submitting a bug report will
              > help us address it:
              >
              > http://sourceforge.net/tracker/?func=add&group_id=165715&atid=836476

              I'd be happy to submit a bug report (and, in fact, I previously did:
              (bug 1685149, which was closed because the behavior in question was as
              designed), but what would you like me to include? Are you saying I
              should open a bug listing some of the ugly workarounds to find out
              whether the drag events to the container are copies or originals?

              The workarounds have been given by other people here on this mailing
              list over the past few days. Here are three I've seen:

              http://tech.groups.yahoo.com/group/ydn-javascript/message/11584
              http://tech.groups.yahoo.com/group/ydn-javascript/message/11601
              http://tech.groups.yahoo.com/group/ydn-javascript/message/10940
            • wizfrob
              ... The workaround you provided in bug 1700201 ( http://sourceforge.net/tracker/index.php?func=detail&aid=1700201&group_id=165715&atid=836476 ) kind of
              Message 6 of 22 , Apr 23 6:22 AM
              • 0 Attachment
                --- In ydn-javascript@yahoogroups.com, Adam Moore <adamoore@...> wrote:
                >
                > On Wed, Apr 04, 2007 at 01:21:23PM -0000, wizfrob wrote:
                > > When I drag a DD item over another DD item that's contained by a
                > > DDTarget, why does the DDTarget receive copies of the drag events that
                > > are sent to the element I'm dragging over?
                >
                > INTERSECT mode was added in part to handle the issue with stacked items,
                > and it was thought at the time that INTERSECT mode would replace POINT
                > mode. That didn't turn out to be the case, as many implementations are
                > easier to work with in POINT mode. The next release will have have a
                > feature to make it easier to work with stacked items in POINT mode.
                >
                > > This behavior is causing me to have to come up with some ugly
                > > workarounds, because when the container receives an event I don't know
                > > whether this is because the user is dragging over it or over something
                > > in it.
                >
                > If you have to resort to ugly workarounds, submitting a bug report will
                > help us address it:
                >
                > http://sourceforge.net/tracker/?func=add&group_id=165715&atid=836476
                >
                > -Adam
                >


                The workaround you provided in bug 1700201
                ("http://sourceforge.net/tracker/index.php?func=detail&aid=1700201&group_id=165715&atid=836476")
                kind of qualifies as an "ugly workaround" to me. It seems as if
                there's a lot of effort being made to figure out whether the DDM
                messages being received should be ignored or not.

                If only there were a single message sent to the DD element being
                directly affected - and that element then had a choice whether to send
                the message down the line - that would simplify the code a lot.

                I haven't worked with INTERSECT mode, but from your comment above it
                sounds like you're acknowledging that the multiple-messages approach
                isn't as appropriate for POINT mode. Is there any chance in a future
                release that, if the DDM is in POINT mode, it could just send a single
                event instead of several copies of that event?
              Your message has been successfully submitted and would be delivered to recipients shortly.