Ticket #5836 (closed defect: invalid)
Tree: dnd between tree and target broken
| Reported by: | guest | Owned by: | bill |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.2 |
| Component: | Dijit | Version: | 1.0 |
| Severity: | normal | Keywords: | |
| Cc: |
Description (last modified by bill) (diff)
The support for dropping from a tree and a target (div) is broken.
I'm not sure what the exact bug is for this: _tree.dndSelector.onMouseDown or dnd.Source.checkAcceptance...
If setting up a dijit.tree and using the _tree.dndSelector as the dndController the class has a function named onMouseDown that checks for the value of current to determine the id and the type. To me, this is a bug in itself because current doesn't get set until some event happens dealing with a container. Because there isn't a value of current, it sets the default value for the type to "data", a String.
in dnd.Source.checkAcceptance, it expects the type of the item to be an array. Then it tries to iterate over the "array" (which is really a string) resulting in no items being acceptable for dropping). Can there ever be more than one type on an item? I would assume no... Below is the code change I made to Source.checkAcceptance which allowed it to work:
if (type instanceof Array) {
for(var j = 0; j < type.length; ++j){
if(type[j] in this.accept){
flag = true;
break;
}
}
}
else
if (type in this.accept) flag = true;