| Page 1 of 1 | [ 3 posts ] |
|
Hello All,
I'm currently working on a customization of the drag-drop sort example (http://developer.yahoo.com/yui/examples ... order.html). My code extends the example to allow elements in the list to be dropped onto a trash icon that will remove the element from the list. To do this I have assigned a new DDlist Object to my trash can image(img#e_delete) and in YAHOO.extend(YAHOO.chalk.cms.DDList, YAHOO.util.DDProxy, { onDragDrop added the following code: Code: onDragDrop: function(e, id) { var Dom = YAHOO.util.Dom; var DDM = YAHOO.util.DragDropMgr; var srcEl = this.getEl(); var destEl = Dom.get(id); var destDD = DDM.getDDById(id); if (destEl.id=='e_delete') { // Call function here to delete the element from the list and database and refresh the list destDD.isEmpty = false; DDM.refreshCache(); } else if (DDM.interactionInfo.drop.length === 1) { var pt = DDM.interactionInfo.point; var region = DDM.interactionInfo.sourceRegion; if (!region.intersect(pt)) { destEl.appendChild(this.getEl()); destDD.isEmpty = false; DDM.refreshCache(); } } }, But what I have noticed is the trash can icon is also draggable. My question is should I assign the trash can as a different object type or is there a way to override the ability to select the trash can as a draggable element. I've tried the following which is unsuccessful: Code: onDrag: function(e) { var Event = YAHOO.util.Event; var y = Event.getPageY(e); var srcEl = this.getEl(); if (srcEl.id=='e_delete') Event.stopEvent(e); |
|
Instead of making it a DDList object, try just making the Trash Can a DDTarget.
Code: var trash = new YAHOO.util.DDTarget('e_delete'); |
|
Perfect!
|
| Page 1 of 1 | [ 3 posts ] |
| 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 |
© YUI Library - Site Credits
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group