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

Drag and drop - deactivate a drop target?

Expand Messages
  • calv_j
    Hi, I m pretty new to the YUI so I m hoping it s just me being slow... But how do you deactivate a drop target - ie. make it so it s no longer a valid target?
    Message 1 of 3 , Jan 28, 2007
    • 0 Attachment
      Hi,

      I'm pretty new to the YUI so I'm hoping it's just me being slow...
      But how do you deactivate a drop target - ie. make it so it's no
      longer a valid target?

      eg.
      // in a loop...
      var dd = new YAHOO.util.DD("icon"+i);
      var target = new YAHOO.util.DDTarget("target"+i);
      dd.onDragDrop = function(e, id) {
      Dom.setXY(this.getEl(), Dom.getXY(id));
      // id is the drop target - how do I make it no longer
      available to other drag clips??
      }

      Basically I have 3 draggable clips, and 3 target divs. Each draggable
      clip can go on any of the 3 targets, but once a target is 'used', non
      of the other draggable clips can land on it...
      I've looked at unreg but don't seem to be having any luck. And I
      looked at groups, but that seemed a bit of a long winded way to get
      it working.
      Any ideas?

      Cheers.

      C.
    • Adam Moore
      ... unreg is what you want: YAHOO.util.DragDropMgr.getDDById(id).unreg(); -Adam
      Message 2 of 3 , Jan 30, 2007
      • 0 Attachment
        On Sun, Jan 28, 2007 at 12:25:30PM -0000, calv_j wrote:
        > Hi,
        >
        > I'm pretty new to the YUI so I'm hoping it's just me being slow...
        > But how do you deactivate a drop target - ie. make it so it's no
        > longer a valid target?
        >
        > eg.
        > // in a loop...
        > var dd = new YAHOO.util.DD("icon"+i);
        > var target = new YAHOO.util.DDTarget("target"+i);
        > dd.onDragDrop = function(e, id) {
        > Dom.setXY(this.getEl(), Dom.getXY(id));
        > // id is the drop target - how do I make it no longer
        > available to other drag clips??
        > }
        >
        > Basically I have 3 draggable clips, and 3 target divs. Each draggable
        > clip can go on any of the 3 targets, but once a target is 'used', non
        > of the other draggable clips can land on it...
        > I've looked at unreg but don't seem to be having any luck. And I
        > looked at groups, but that seemed a bit of a long winded way to get
        > it working.
        > Any ideas?

        unreg is what you want:

        YAHOO.util.DragDropMgr.getDDById(id).unreg();

        -Adam
      • calv_j
        Cheers Adam, yeah I think it is... must have been doing it a bit wrong before! Thanks again, C.
        Message 3 of 3 , Jan 31, 2007
        • 0 Attachment
          Cheers Adam, yeah I think it is... must have been doing it a bit wrong
          before!
          Thanks again,

          C.
          --- In ydn-javascript@yahoogroups.com, Adam Moore <adamoore@...> wrote:
          >
          > unreg is what you want:
          >
          > YAHOO.util.DragDropMgr.getDDById(id).unreg();
          >
          > -Adam
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.