Opened 11 years ago

Closed 11 years ago

#5530 closed defect (fixed)

[patch] [cla] Dijit Tree _expandNode method fires twice on exapnd event

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

Description (last modified by bill)

If you attach a listener for _expandNode it will fire 2 times and should only fire once. Looking at the Tree.js code I don't see where the two events are getting fired from but they are.

dojo.connect( _widget.tree, "_onExpand", function(node){

alert("fire");

});

A work around for now is to connect to the _onExpandoClick and then look at whether the message.node isExpanded property is set or not.

dojo.connect( tree, "_onExpandoClick", function(message){

alert("fire");

});

Attachments (1)

Tree.js.diff (520 bytes) - added by guest 11 years ago.
[cla] [patch] allow a dojo.connect on the node expansion (nicola.rizzo+dojo@…)

Download all attachments as: .zip

Change History (9)

comment:1 Changed 11 years ago by bill

Are you saying that clicking on the plus sign will cause _expandNode() to be called twice?

comment:2 Changed 11 years ago by bill

Component: GeneralDijit
Owner: anonymous deleted

comment:3 Changed 11 years ago by guest

When the state of a node is "UNCHECKED" (when the node starts collapsed), the _expandNode method calls _onLoadAllItems, which calls again _expandNode on the same node. This time the code under switch(node.state) ... default: is executed.

Generally you can't connect a private method (_expandNode); with this little patch you can safely use dojo.connect(tree, "expandNode",...);

Nicola

Changed 11 years ago by guest

Attachment: Tree.js.diff added

[cla] [patch] allow a dojo.connect on the node expansion (nicola.rizzo+dojo@…)

comment:4 Changed 11 years ago by bill

Milestone: 1.1
Owner: set to bill

comment:5 Changed 11 years ago by bill

Summary: Dijit Tree _expandNode method fires twice on exapnd event[patch] [cla] Dijit Tree _expandNode method fires twice on exapnd event

comment:6 Changed 11 years ago by bill

Milestone: 1.11.2

comment:7 Changed 11 years ago by bill

Description: modified (diff)
Status: newassigned

OK, seems like what this ticket is really asking for is easy way to be notified when a node/item is opened/closed. I'll add that in.

comment:8 Changed 11 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [13802]) Notification when Tree node is opened/closed. Fixes #5530. !strict

Note: See TracTickets for help on using tickets.