Opened 11 years ago

Closed 11 years ago

#11532 closed defect (duplicate)

[regression] Popup context menu on DataGrid throws error.

Reported by: gregorokorn Owned by: bryanforbes
Priority: high Milestone: tbd
Component: DojoX Grid Version: 1.5
Keywords: forEach Cc: [email protected]
Blocked By: Blocking:


We just switched from dojo 1.3.1 to 1.5 and all of our DataGrid?'s that define the headerMenu attribute fail to render in IE6 and IE7. Firefox worked fine. My investigation led me to the section of dojo 1.5 javascript below:

// Se need to extend dijit.Menu so that we have a getPlaceholders function.
dojo.extend(dijit.Menu, {
        getPlaceholders: function(/*String?*/ label){
                // summary:
                //              returns an array of placeholders with the given label.  There
                //              can be multiples.
                // label:
                //              Label to search for - if not specified, then all placeholders
                //              are returned
                // returns:
                //              An array of placeholders that match the given label
                var r = [];
                var children = this.getChildren();
//failed              children.forEach(function(child){
//worked                dojo.forEach(children, function(child){
                        if(child._isPlaceholder && (!label || child.label == label)){
                        }else if(child._started && child.popup && child.popup.getPlaceholders){

                                r = r.concat(child.popup.getPlaceholders(label));
                        }else if(!child._started && child.dropDownContainer){

                                var node = dojo.query("[widgetId]", child.dropDownContainer)[0];
                                var menu = dijit.byNode(node);

                                        r = r.concat(menu.getPlaceholders(label));
                }, this);
                return r; // dojox.widget.PlaceholderMenuItem[]

where the failed is the place that threw a javascript error due to the "forEach" function being undefined in IE. I commented it out and used the worked line instread and now both IE and Firefox render fine.

I noticed in the dojo 1.5 release notes this section:


Code like


should be changed to

     dojo.forEach(myWidget.getChildren(), ...);

Although getChildren() was always documented as returning a plain array, in version 1.4 it actually returned an array with methods like forEach() and filter(), so some user code may be depending on that.

and assume that this explains the problem and validates my fix. If so, could this fix be applied for the next version?


Change History (2)

comment:1 Changed 11 years ago by bill

Summary: Popup context menu on DataGrid throws error.[regression] Popup context menu on DataGrid throws error.

comment:2 Changed 11 years ago by bill

Resolution: duplicate
Status: newclosed

Dup of #11319.

Note: See TracTickets for help on using tickets.