Login Register

dnd

dynamic dnd containers

Problem: I need to be able to create containers on the page that can hold dnd nodes after the page has already been created. For example, a user clicks a button and it creates a new container next to the containers that have already been created. Is this possible? I understand how to create containers I'm just stuck on this.

DND Accept All?

I want to restrict then number of items in a dnd target to 8. To do this, I've added the line:

if (reslength==8) target.accept="";

This works fine, but how do I then allow items to be dropped again once reslength has been reduced. Basically, how to I set target.accept back to the default value? I've read that this is ["text"], but obviously this stops the target from accepting anything with a dndType other than "text". I want the target to accept ALL items when reslength < 8.

Thanks in advance.

dnd.constrainedMoveable question - is it possible to get the moveable item to 'follow' the mouse pointer?

Hi,

I'm hoping someone can help. I have been using constrainedMoveable and have a page with a container div and a smaller div inside. At the moment, the user is able to drag the smaller div around inside the constraints of the parent container and this works very well.

However, I'd been trying to get the smaller div to track with the pointer as soon as the user moves the mouse into the containing div - in other words: as soon as they move into the containing div, I'd like the smaller div to follow the pointer around.

Drag and Drop - delete/throwaway node if dragged to non-target

I have a dojo.dnd.Source of items (copyOnly=true, so the original items remain in the source) that can be dragged and dropped into various other sources. I wanted the functionality of being able to 'throw them away' from the source they were added to, simply by flicking them away with the mouse (i.e., dragging them to a region on the page that was not a source or a target). I came up with the following solution, which I am presenting here not only to help anybody else that might have the same need, but also to get any suggestions as to how this solution might be improved.

Drag and Drop Tabs - Are they possible?

Hi,

I've been trying to implement drag and drop tabs but have had no success.

I have managed to set the TabContainer as a Source and apply the dojoDndItem class to each tab but this has no effect. I've implemented drag and drop many times before and had no problems so why doesn't it work for the TabContainer?

Is it possible to have drag and drop tabs?

In my initial investigation I was only aiming to move the tabs and not their associated content. My intention is to move the content once the tabs themselves are dnd enabled.

Here is my code:

can't determine dropped item when using a custom node creator

Hi,

I've choosen dojo for drag and drop because it works smoothly and the features are great, but I'm having trouble getting the information after dropping an item in another list. It works fine if I don't use a custom node creator, but otherwise target.getItem returns undefined.

I've prepared the simplest possible example to demonstrate this issue:

dojo.require("dojo.dnd.Container");
dojo.require("dojo.dnd.Manager");
dojo.require("dojo.dnd.Source");

var nodeCreator = function(item) {
var node = dojo.doc.createElement("li")
node.innerHTML = item

get all targets or sources on a page

Is there anyway to get a list of every target or source on a page that would have a drag and dropped object in it?

DND/Drag and Drop: Validation on target

Hi All,

I'm trying to add a validation to check if there's a similar item on target, then don't add the item to the target. How do I do this?

I don't understand how to access the nodes on the target. So that I can check them one by one.

Here's some of my code:

var checkAcceptanceWithoutDuplicating = function(source, nodes) {
if(this == source){ return false; }
console.log("Node is: " + nodes.length);
for(var i = 0; i < nodes.length; ++i){
//console.log("Node is: " + source.getItem(nodes[i].id).name); //tried this but didn't work.

[patch] DnD extension: 2D (i.e. non-linear) Container using absolute positioning

I extended the DnD module to support inserting items at the position where they are dropped. It is done by absolute positioning within the Container.
I created a simple demo at http://mikula.ic.cz/dnddemo/
Basically, when Manager publishes the "/dnd/drop" topic, it passes an additional argument -- mouse event that caused the drop.
Container constructor accepts an additional Boolean parameter absolutePositioning -- when true, the items are positioned absolutely within the container at the position calculated from the passed mouse event.
I provide the diff below.

[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:

Syndicate content