Login Register

dojo.dnd.Source

[Solved] source.getItem(this.manager.nodes[i].id) is undefined (dynamic dnd)

Hi,

I've been searching the forums for an answer regarding dynamically adding/removing nodes to a dojo.dnd.Source and have been successful in that it essentially "works". Even though it does work, I get the following error in my ff console:

Error: source.getItem(this.manager.nodes[i].id) is undefined
Source File: http://localhost/trunk/public/scripts/dojo/dojo/dojo.js.uncompressed.js
Line: 477

whenever I drag a created node. Has anyone come across such an error or can guide me on finding out more about what it is? Line 477 is a line a block comment.

Here's my creator:

How to access data in items in a dnd container?

My dojo.dnd.Source cart has items in it. Each item has data associated with it. We know this because the creator can access data.name, data.price, etc.

When a new item is dropped onto cart, I want to update a "Your total is" display, by adding up data.price of all the items in the cart.

But cart.getAllNodes() returns an array of HTMLDivElement and the data isn't accessible.

How do I access the data in each item in a dojo.dnd.Source?

How to get a reference to a widget within the nodes param (dndItem) of a published /dnd/drop?

[editor: moved to the proper forum...]

I want to get a reference to my widget that's a dndItem. When I get a drop published I get the nodes but I can't dijit.byId(nodes[0].id) it doesn't give me a dijit back it gives me undefined, obviously dojo.byId() gives me the node but it's not useful to me. So I've taken to getting the drop and querying the contents for the dojo widget I know is in there somewhere and then dijit.byId("theFoundNodeId") to get access to the widget. Is there a better way to do this?

Can dojo.dnd.Source be inherited from???

Immediately when I mix in dojo.dnd.Source my widget doesn't instantiate... remove it and programmatically instantiate it onto the this.domNode of my widget and it works... If it works it works but I was wondering why I can't seem to mix it in??? Can't seem to inherit from it even when it is the superclass and I don't mix in any other widgets.

dojo.declare("myWidget.Name", [dijit.layout.ContentPane, dijit._Templated, dojo.dnd.Source],

Can the dnd method .insertNodes(false, []) take an array of widgets?

I've created an array of widgets, loaded from a store and fully instantiated in a specific order. It goes into my creator function no problem myCreator(item, hint) where the item instead of being a string is an object and I just pass it through after adding a dnd unique id but it stops after returning the first item.

// create function body
node.id = dojo.dnd.getUniqueId();
return {node: node, data: node.label, type: ["canvas"]};
Syndicate content