--- In ydn-javascript@yahoogroups.com, "scepiccoder" <scepiccoder@...>
wrote:
>
> Hi All,
> would appreciate if someone could help me out.
> just some of information,the drag and drop that im using is from here,
> http://developer.yahoo.com/yui/examples/dragdrop/dd-reorder.html
>
> and what i need to do is , lets say the the list1,item1 cannot be
> dragged to list2. now i have another panel list3.so i cant lock the
> drag, as it i still allow the list1,item1 to be dragged to list3.
>
> --- In ydn-javascript@yahoogroups.com, "scepiccoder" <scepiccoder@>
> wrote:
> >
> > Thanks for the reply dav, but im still not clear of what i need to do.
> > before making the element go back to the original position, im having
> > trouble of cancelling the drag first.
> >
> > calling the method,
> >
> > if (((thisid2=="2_1") || (thisid2=="2_2"))&&(id=="ul3"))
> > {
> >
> > this.stopDrag(e,1);
> > this.stopEvent(e);
> > }
> >
> > doesn't cancel the drag. or even a return false still drops the elemnt
> > to the third panel. could you help me to point where is my mistakes?
> > is the way im calling the stopDrag method is wrong. Im having some
> > trouble understang the code, sorry if i sound too lame.
> >
> > --- In ydn-javascript@yahoogroups.com, Dav Glass <dav.glass@> wrote:
> > >
> > > scepiccoder --
> > >
> > > First thing is you need to know the position of the element when you
> > start dragging.
> > >
> > > So in the onMouseDown method, grab the dragEls xy with getXY..
> > >
> > > Then when you want to cancel the drag, just cancel it and set the XY
> > of the dragEl back to that xy..
> > >
> > > Does that make sense?
> > > Dav
> > >
> > > Dav Glass
> > > dav.glass@
> > > blog.davglass.com
> > >
> > >
> > >
> > >
> > > + Windows: n. - The most successful computer virus, ever. +
> > > + A computer without a Microsoft operating system is like a dog
> > > without bricks tied to its head +
> > > + A Microsoft Certified Systems Engineer is to computing what a
> > > McDonalds Certified Food Specialist is to fine cuisine +
> > >
> > >
> > >
> > > ----- Original Message ----
> > > From: scepiccoder <scepiccoder@>
> > > To: ydn-javascript@yahoogroups.com
> > > Sent: Tuesday, August 19, 2008 1:34:21 AM
> > > Subject: [ydn-javascript] how to cancel a dragged element to return
> > to its original position onDragOver
> > >
> > > Hi,
> > >
> > > Im new to this forum. I have already implemented the drag and drop
> > > feature. Now I have to add anotehr panel, so all together i have 3
> > > panel that have elements in it. Only certain elements from panel 1
> > > and 2 can be dragged to the new panel. SO i need to identify which
> > > are the elements.
> > >
> > > I am able to do so at the onDragOver:
> > >
> > > onDragOver: function(e, id) {
> > >
> > > var srcEl = this.getEl();
> > > var destEl = Dom.get(id);
> > >
> > > var thisid2 = this.id;
> > >
> > > // THIS IS WHERE I IDENTIFY THE CERTAIN ELEMENT THAT SHOULD
NOT BE
> > > DRAGGED TO PANEL NO 3
> > > if (((thisid2=="2_1") || (thisid2=="2_2") ||
(thisid2=="2_3")
> > > || (thisid2=="2_4") || (thisid2=="2_5") || (thisid2=="2_6") ||
> > > (thisid2=="2_7") || (thisid2=="2_8") || (thisid2=="2_9") ||
> > > (thisid2=="2_10") || (thisid2=="1_1") || (thisid2=="1_2") ||
> > > (thisid2=="1_3") || (thisid2=="1_4") || (thisid2=="1_5") ||
> > > (thisid2=="1_6") || (thisid2=="1_7") || (thisid2=="1_8") ||
> > > (thisid2=="1_9") || (thisid2=="1_10"))&&(id=="ul3"))
> > > {
> > >
> > > alert("cannot drag component to holder")
> > > this.goingUp = true;
> > > endDragEvent();
> > > return false;
> > > }
> > > else
> > > {
> > > }
> > >
> > >
> > >
> > > // We are only concerned with list items, we ignore the
> > > dragover
> > > // notifications for the list.
> > > if (destEl.nodeName.toLowerCase() == "li") {
> > >
> > > var orig_p = srcEl.parentNode;
> > > var p = destEl.parentNode;
> > >
> > > if (this.goingUp) {
> > > p.insertBefore(srcEl, destEl); // insert above
> > > } else {
> > > p.insertBefore(srcEl, destEl.nextSibling); //
insert
> > > below
> > > }
> > >
> > > DDM.refreshCache();
> > >
> > > }
> > > }
> > >
> > >
> > > I can alert if the invalid element is dragged to teh 3rd panel, but
> > > then it is dropped in the panel, what I need is for the invalid
> > > elements to be returned back to its original position. anything
> > > other than the specified ID should be allowed to drop in the 3rd
> > > panel(ul=3).
> > >
> > > Can somebody help. Im not really sure how this should be done.And i
> > > believe my method here is wrong:
> > >
> > > alert("cannot drag component to holder")
> > > this.goingUp = true;
> > > endDragEvent();
> > > return false;
> > >
> > >
> > >
> > > ------------------------------------
> > >
> > > Yahoo! Groups Links
> > >
> >
>