Opened 8 years ago

Closed 4 years ago

#13791 closed defect (patchwelcome)

Tree: support DnD between trees/plain containers connected to different stores

Reported by: bill Owned by:
Priority: low Milestone: 1.13
Component: Dijit Version: 1.6.1
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

When dragging from one Tree to another, and the Trees are connected to different stores, there are a number of pieces of missing functionality, including:

1) delete items from old store

dojo/dnd/Source.js has this code run on drop:

if(!copy && this.creator){
	source.deleteSelectedNodes();
}

There's no equivalent code for when the target is a Tree. Thus, the element won't be deleted from the source, regardless of whether the source is a Tree or not.

If the source is a Tree, it becomes more complicated, because the TreeNode being dragged may represent an item with multiple parents. In this case, should the whole item be deleted, or just unlink the parent/child relationship indicated by that TreeNode? Probably the former.

2) adding nodes to target

If the user drags "Asia" from TreeA to TreeB, seems like it should move not only "Asia", but all the descendants of "Asia" too, some of which may not even have been fetched from the data store yet.

3) label created incorrectly

The itemCreator() method gets the new node's label (a.k.a. name) like this:

return {
	"id": node.id,
	"name": node.textContent || node.innerText || ""
};

For TreeNodes that gets some garbage characters (newlines and spaces), and probably has issues with special characters like "&" too. Should be calling store.getLabel(node.item), or something like that.

Change History (4)

comment:1 Changed 8 years ago by bill

Description: modified (diff)

comment:2 Changed 8 years ago by bill

Description: modified (diff)

comment:3 Changed 7 years ago by bill

Priority: highlow

comment:4 Changed 4 years ago by dylan

Milestone: future1.12
Resolution: patchwelcome
Status: newclosed

Given that no one has shown interest in creating a patch in the past 4+ years, I'm closing this as patchwelcome.

Note: See TracTickets for help on using tickets.