views:

444

answers:

1

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

A: 

YAHOO.util.Event.preventDefault(e); should cancel the event.

Drew Freyling