Opened 12 years ago

Closed 12 years ago

#4957 closed defect (fixed)

Incorrect Method Signature for dijit.Tree.onClick

Reported by: ptwobrussell Owned by: alex
Priority: high Milestone: 1.0
Component: Dijit Version: 1.0
Keywords: Cc: ptwobrussell@…
Blocked By: Blocking:

Description

The method signature is not correct, as it omits a second parameter that is passed in from _onClick, which is a reference to the node that was clicked. Without knowing about that second parameter (which you would not unless you read the source to _onClick), you have to resort to "unapproved" methods of getting a domNode reference when a tree node is clicked. See the patch below for clarification:

Index: Tree.js
===================================================================
--- Tree.js     (revision 11233)
+++ Tree.js     (working copy)
@@ -669,7 +669,7 @@
                this.saveState();
        },
 
-       onClick: function(/* dojo.data */ item){
+       onClick: function(/* dojo.data */ item, /* DomNode */ domElement){
                // summary: user overridable function for executing a tree item
        },

This may not seem like much, but it's an important omission in the API to fix, because without it, makes a very common operation impossible to perform without munging private members (which even to figure that out takes some time).

Change History (2)

comment:1 Changed 12 years ago by Adam Peller

Component: GeneralDijit

comment:2 Changed 12 years ago by bill

Resolution: fixed
Status: newclosed

(In [11253]) Fixes #4957: Incorrect Method Signature for dijit.Tree.onClick (This is essentially a documentation update)

Note: See TracTickets for help on using tickets.