Opened 11 years ago

Closed 9 years ago

Last modified 8 years ago

#5960 closed task (fixed)

add DropDownButton.setDropDown() method

Reported by: guest Owned by:
Priority: high Milestone: 1.4
Component: Dijit - Form Version: 1.0
Keywords: Cc: alex, paulprincewv@…
Blocked By: Blocking:

Description (last modified by bill)

Tested in version 1.0.1. This bug is reproducable.

Given:

var toolbar   = new dijit.Toolbar();
var button    = new dijit.form.DropDownButton({ label: 'Button Label' });
var menu      = new dijit.Menu();
var menuitem  = new dijit.MenuItem({ label: 'Menu Item' });

It should be possible to create an desktop-application-like menubar like so:

toolbar.addChild( button );
button.addChild( menu );
menu.addChild( menuitem );

But this does not work.

Instead of calling button.addChild(), you must directly set button's .dropDown property like so:

button.dropDown = menu;

This appears to be a defect.

If DropDownButton.addChild() is inappropriate for this action, perhaps DropDownButton.addDropDown() would be correct.

Bug filed by teatime <paulprincewv@…> at the request of slightlyoff from irc://irc.freenode.net/#dojo

Change History (8)

comment:1 Changed 11 years ago by alex

Cc: alex paulprincewv@… added
Milestone: 1.2

comment:2 Changed 11 years ago by bill

Resolution: invalid
Status: newclosed

No, it's working as designed. addChild() is more for the case where you can have any number of children (including zero)... not this case where there is a one-to-one mapping.

comment:3 Changed 11 years ago by alex

Resolution: invalid
Status: closedreopened

bill:

even if addChild is designed to do something different, there should be an addPopup or setDropDown() method on the dropDownButton.

comment:4 Changed 11 years ago by bill

Description: modified (diff)
Milestone: 1.21.4
Summary: Adding Menu to DropDownButton via. addChild() fails, must set .dropDown property directlyadd DropDownButton.setDropDown() method
Type: defecttask

OK, not sure what the advantage of a method would be beyond setting that property directly. Perhaps there's some additional book keeping it needs to do.

comment:5 Changed 10 years ago by bill

Milestone: 1.41.5

bumping 1.4 tickets to 1.5, and most 1.3 tickets to 1.4

comment:6 Changed 9 years ago by Adam Peller

Milestone: 1.51.6

comment:7 Changed 9 years ago by bill

Milestone: 1.61.4
Resolution: fixed
Status: reopenedclosed

This is working in 1.4 via the standard widget API of:

dijit.byId("color").attr("dropDown", new dijit.Calendar({}))

and then in 1.5 by using set() rather than attr().

Might even be working before 1.4, not sure, but anyway marking as fixed in 1.4.

comment:8 Changed 8 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.