Ticket #5960 (reopened task)

Opened 4 months ago

Last modified 3 days ago

add DropDownButton.setDropDown() method

Reported by: guest Owned by:
Priority: normal Milestone: 1.4
Component: Dijit Version: 1.0
Severity: normal Keywords:
Cc: alex, paulprincewv@…

Description (last modified by bill) (diff)

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

Changed 4 months ago by alex

  • cc alex, paulprincewv@… added
  • milestone set to 1.2

Changed 4 months ago by bill

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

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.

Changed 4 months ago by alex

  • status changed from closed to reopened
  • resolution deleted

bill:

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

Changed 3 days ago by bill

  • summary changed from Adding Menu to DropDownButton via. addChild() fails, must set .dropDown property directly to add DropDownButton.setDropDown() method
  • type changed from defect to task
  • description modified (diff)
  • milestone changed from 1.2 to 1.4

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.

Note: See TracTickets for help on using tickets.