[Dojo-interest] Issue with dnd in a Dijit Tree

Paul D. Fernhout pdfernhout at kurtz-fernhout.com
Tue May 5 14:39:47 EDT 2015


Try this version of your JSFiddle which should update on a drag-and-drop:

I modified it based on consulting the code for this demo:

I used Observable to wrap the Memory store. I also used "aspect" to 
handle the put function as suggested here:

I also first made it just one tree with a hidden root because I was 
concerned about this, but I did not actually try it with the two trees:

I'm not sure if all of those three things are required though. It was a 
few iterations to get it to work. I think the Observable wrapping is 
probably needed at the very least to get the GUI updating for the drop. 
And probably the aspect wrapping.

So, you might be able to use some of that to get your original with two 
separate trees to work. Let me know if it works with two seperate trees 
despite the StackOverflow report.

--Paul Fernhout

On 5/5/15 1:12 PM, Harry Devine wrote:
> I've given this a couple of days and I'm still having no luck.  The
> example at
> http://download.dojotoolkit.org/release-1.10.4/dojo-release-1.10.4/dijit/tests/tree/test_Tree_DnD.html works
> as you'd expect, but the JSFiddle below doesn't work at all.  I really
> need help on this one if someone can take a look at the fiddle.
> Thank you!
> Harry
> ------------------------------------------------------------------------
> *From: *"Harry Devine" <lifter89 at comcast.net>
> *To: *dojo-interest at mail.dojotoolkit.org
> *Sent: *Friday, May 1, 2015 8:55:20 AM
> *Subject: *[Dojo-interest] Issue with dnd in a Dijit Tree
> I have a Dijit Tree that represents servers in our server room.  Each
> tree represents a rack and each node is a server in that rack.  What I
> would like to do is implement drag and drop to move a server from 1 rack
> to the other.  If we ever physically move a server, I'd like to be able
> to go to our page and dnd that server from rack 1 to rack 2 or vice
> versa (obviously I'd have to have code underneath to update our MySQL
> database where this data is stored).
> I have implemented drag-n-drop according to the examples and docs, but
> when I drop the data onto the desired node, nothing happens.  No updates
> to the tree.  I have created a JSFiddle to illustrate this.  If you drag
> something from Rack 1 to Rack 2, the dnd shows the avatar, but when the
> drop happens, nothing updates.  If I drop a node, such as Server 3, onto
> another node like Server 1, all that happens is Server 1 is
> opened/expanded, but nothing is moved/dropped.
> Here's the fiddle URL: http://jsfiddle.net/yo35y1rz/
> Any ideas?
> Thanks,
> Harry
> --
> Dojo Toolkit: http://dojotoolkit.org/
> Tutorials: http://dojotoolkit.org/documentation/
> Dojo-interest at mail.dojotoolkit.org
> To unsubscribe, visit:
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

More information about the Dojo-interest mailing list