Opened 13 years ago

Closed 12 years ago

#6238 closed defect (fixed)

Tree: "'item' has no properties" message in dndSelector.js

Reported by: guest Owned by: bill
Priority: high Milestone: 1.2
Component: Dijit Version: 1.0
Keywords: dndSelector tree Cc: dante
Blocked By: Blocking:

Description (last modified by bill)

It seems that the following code in dijit.tree.dndSelector causes an error when a tree is rootless (at least that's my guess)....

onMouseDown: function(e){
	// summary: event processor for onmousedown
	// e: Event: mouse event
	if(!this.current){ return; }

	var item = dijit.getEnclosingWidget(this.current).item

When I expand a node in the top-level of the tree, the item variable is undefined in the code above, leading to the error message "'item' has no properties".

Changing the code to...

var id = (item ? this.tree.model.getIdentity(item) : "root");

...seems to temporarily fix the problem for me, but I don't understand the code well enough to know if this is a valid fix.

Change History (7)

comment:1 Changed 13 years ago by bill

What did you do trigger this error to occur? Can you attach a test case? Thx.

comment:2 Changed 13 years ago by bill

Milestone: 1.11.2

comment:3 Changed 13 years ago by bill

Owner: set to bill
Summary: "'item' has no properties" message in dndSelector.jsTree: "'item' has no properties" message in dndSelector.js

comment:4 Changed 12 years ago by dante

Cc: dante added
Description: modified (diff)

bill are you working on this? the _tree/test_TreeDnD is horribly broken in trunk, and I'm looking into some stuff ... would like to coordinate.

comment:5 Changed 12 years ago by bill

Description: modified (diff)

Haven't started working on it but I was planning to look at tree bugs over the next few days. I'll wait for you to do your stuff first though. As I wrote in the comment above I need a test case before working on this (ie, instructions on how to reproduce).

comment:6 Changed 12 years ago by bill

Status: newassigned

Peter reproduced this or a similar error in test_Tree.html by dropping to the left of the TreeNode (but still within the tree). Since the mouse isn't over a TreeNode we run into problems. Actually, the drop icon should be red in that case, but it's green.

comment:7 Changed 12 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [13801]) Disable dropping onto the Tree itself rather than onto a particular TreeNode? within the tree. Some of the current code assumes that all drops are onto TreeNodes? (thus causing "item not defined" errors when that isn't true), and also, allowing drops onto the Tree itself is error prone since a user may drop to the left of a TreeNode? thinking that they are dropping onto the TreeNode? itself (but they aren't). At some point should implement dropping between nodes so that we can support adding top level items to a rootless tree. Fixes #6238. !strict

Note: See TracTickets for help on using tickets.