[ 4 posts ]

Ventzy Kunev

  • Username: Ventzy
  • Joined: Thu Nov 05, 2009 2:41 am
  • Posts: 35
  • Offline
  • Profile

How to properly delegate drop targets

Post Posted: Thu Mar 22, 2012 4:45 am
+0-
I have ul element that must be drop target, and not draggable by itself. The code below makes it draggable.

Code:
    var ddlUl = new Y.DD.Delegate(
    {
        container: '#play',
        nodes: 'ul',
        target: true //Add in this attribute to add drop delegation capabilities
    }); 


Ultimatelly I want to have nested drop targets, so in some li in this ul to have another drop target.

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile
Tags:

Re: How to properly delegate drop targets

Post Posted: Thu Mar 22, 2012 5:34 am
+0-
Basically you need to set the UL as a `Y.DD.Drop` target, then use Y.DD.Delegate to make the LI's in the list draggable and droppable.

Ventzy Kunev

  • Username: Ventzy
  • Joined: Thu Nov 05, 2009 2:41 am
  • Posts: 35
  • Offline
  • Profile

Re: How to properly delegate drop targets

Post Posted: Thu Mar 22, 2012 6:37 am
+0-
Yes, I have done it that way.

However, there is no "delegation" (of drop targets) in this approach, so when my nested drop target is dynamically created in the list, I need to make manually another Y.DD.Drop instance. I wanted to avoid that, with some kind of delegation, but maybe Y.DD.Delegate is not intended for such use case.

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile

Re: How to properly delegate drop targets

Post Posted: Thu Mar 22, 2012 9:02 am
+0-
Right, Target's are not supported with Delegate. Only drags are.
  [ 4 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum