[Dojo-interest] New to the list! (I also have a question)

Calvin Lai callai at gmail.com
Fri Jul 17 13:00:29 EDT 2009


Hey Seth,

I'm restricting only one item to be dragged into Target. I do that by using
the onDraggingOver event to check if nodes already exist in the drop area.

That's why I want a singular way to access the data member without having to
run through a loop.

P.S. You're the same Seth that's been helping me at stackoverflow, yeah?

--
Calvin Lai
Business Development
http://dealspl.us


On Fri, Jul 17, 2009 at 9:42 AM, Seth Mason <seth at slackorama.com> wrote:

> The onDrop method takes three arguments: source, nodes and copy.
>
> You can do something like this:
>
>
> var dropItems;
>
> dojo.connect(pollItem, "onDrop", function(source,nodes,copy) {
>    dojo.forEach( nodes, function(node) {
>       var item = source.getItem( node.id );
>       dropItems.push( item );
>   }
> });
> console.log( dropItems );
>
> Remember that with dojo.dnd more than one item can be dragged and dropped.
>
> HTH,
> SETH
>
>
> On Fri, Jul 17, 2009 at 9:28 AM, Calvin Lai<callai at gmail.com> wrote:
> > Hello everyone!
> >
> > I just signed up for the dojo interest list. I'm not sure how many people
> > read this but I have a question and am hoping someone can help me with
> it.
> >
> > I'm working with dojo.dnd to create a drag and drop application. The
> > application utilizes a dojo.dnd.Source object and a dojo.dnd.Target
> object.
> > I've set up an event listener to connect to the Target object, so that
> > Target takes information from the dropped item.
> >
> > var dropRef = dojo.connect(pollItem, "onDrop", function() {
> >     for (var v in pollItem.map) {
> >         var data = pollItem.getItem(v).data;
> >         break;
> >     }
> >     console.log(data);
> > });
> >
> > The issue is that pollItem.map (pollItem is the reference to the Target
> > object that I created) contains an object called dojoUnique35 which holds
> an
> > object called data (the good stuff that I need). Depending on how many
> dnd
> > items I have on the page at a given time, dojoUnique# changes. I looked
> > through pollItem and could not find any reference to the unique ID that
> is
> > assigned by dojo. The above code works and I can access all the members
> of
> > data, but I'm not very keen on using a loop to access it, especially
> since
> > it only has one member object. Any ideas?
> >
> > I appreciate any input!
> >
> > Calvin
> >
> > _______________________________________________
> > FAQ: http://dojotoolkit.org/support/faq
> > Book: http://dojotoolkit.org/docs/book
> > Forums: http://dojotoolkit.org/forum
> > Dojo-interest at mail.dojotoolkit.org
> > http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
> >
> >
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest at mail.dojotoolkit.org<http://dojotoolkit.org/forum%0ADojo-interest@mail.dojotoolkit.org>
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-interest/attachments/20090717/9cf2bac2/attachment.htm 


More information about the Dojo-interest mailing list