Ticket #4957 (closed defect: fixed)

Opened 13 months ago

Last modified 13 months ago

Incorrect Method Signature for dijit.Tree.onClick

Reported by: ptwobrussell Owned by: alex
Priority: normal Milestone: 1.0
Component: Dijit Version: 1.0
Severity: normal Keywords:
Cc: ptwobrussell@…

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

Changed 13 months ago by peller

  • component changed from General to Dijit

Changed 13 months ago by bill

  • status changed from new to closed
  • resolution set to fixed

(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.