How to cancel drop event in YUI drag & drop utility?

Posted by gk on Stack Overflow See other posts from Stack Overflow or by gk
Published on 2009-05-10T16:58:53Z Indexed on 2010/04/13 6:53 UTC
Read the original article Hit count: 382

Filed under:
|
|

We are using drag & drop utility between one source and multiple targets. We have a restriction that one of the target can only have one child element while the other ones can have multiple items.

I have tried subscribing dragDropEvent of the proxy item and returning false in case the destination target has multiple child elements, with out much luck.

 var m = new YAHOO.example.DDList("dli" + j, 'documentSelection');
           m.subscribe('dragDropEvent', function(e){                            
                if (e.info == 'ulMasterDocument' && $('#ulMasterDocument').children().length > 1){                  
                    e.event.canceBubble = true;
                    return false;
                }
                return true; 
             });

Is this code correct? Or do i need to subscribe some other event?

Thanks

© Stack Overflow or respective owner

Related posts about yui

Related posts about dragdrop