2 'url:dijit/form/templates/DropDownButton.html':"<span class=\"dijit dijitReset dijitInline\"\n\t><span class='dijitReset dijitInline dijitButtonNode'\n\t\tdata-dojo-attach-event=\"ondijitclick:_onClick\" data-dojo-attach-point=\"_buttonNode\"\n\t\t><span class=\"dijitReset dijitStretch dijitButtonContents\"\n\t\t\tdata-dojo-attach-point=\"focusNode,titleNode,_arrowWrapperNode\"\n\t\t\trole=\"button\" aria-haspopup=\"true\" aria-labelledby=\"${id}_label\"\n\t\t\t><span class=\"dijitReset dijitInline dijitIcon\"\n\t\t\t\tdata-dojo-attach-point=\"iconNode\"\n\t\t\t></span\n\t\t\t><span class=\"dijitReset dijitInline dijitButtonText\"\n\t\t\t\tdata-dojo-attach-point=\"containerNode,_popupStateNode\"\n\t\t\t\tid=\"${id}_label\"\n\t\t\t></span\n\t\t\t><span class=\"dijitReset dijitInline dijitArrowButtonInner\"></span\n\t\t\t><span class=\"dijitReset dijitInline dijitArrowButtonChar\">▼</span\n\t\t></span\n\t></span\n\t><input ${!nameAttrSetting} type=\"${type}\" value=\"${value}\" class=\"dijitOffScreen\" tabIndex=\"-1\"\n\t\tdata-dojo-attach-point=\"valueNode\"\n/></span>\n"}});
3 define("dijit/form/DropDownButton", [
4 "dojo/_base/declare", // declare
5 "dojo/_base/lang", // hitch
7 "../registry", // registry.byNode
8 "../popup", // dijit.popup2.hide
12 "dojo/text!./templates/DropDownButton.html"
13 ], function(declare, lang, query, registry, popup, Button, _Container, _HasDropDown, template){
16 Button = dijit.form.Button;
17 _Container = dijit._Container;
18 _HasDropDown = dijit._HasDropDown;
22 // dijit/form/DropDownButton
24 // A button with a drop down
27 return declare("dijit.form.DropDownButton", [Button, _Container, _HasDropDown], {
29 // A button with a drop down
32 // | <button data-dojo-type="dijit.form.DropDownButton">
34 // | <div data-dojo-type="dijit.Menu">...</div>
38 // | var button1 = new dijit.form.DropDownButton({ label: "hi", dropDown: new dijit.Menu(...) });
39 // | win.body().appendChild(button1);
42 baseClass : "dijitDropDownButton",
44 templateString: template,
46 _fillContent: function(){
47 // Overrides Button._fillContent().
49 // My inner HTML contains both the button contents and a drop down widget, like
50 // <DropDownButton> <span>push me</span> <Menu> ... </Menu> </DropDownButton>
51 // The first node is assumed to be the button content. The widget is the popup.
53 if(this.srcNodeRef){ // programatically created buttons might not define srcNodeRef
54 //FIXME: figure out how to filter out the widget and use all remaining nodes as button
55 // content, not just nodes[0]
56 var nodes = query("*", this.srcNodeRef);
57 this.inherited(arguments, [nodes[0]]);
59 // save pointer to srcNode so we can grab the drop down widget after it's instantiated
60 this.dropDownContainer = this.srcNodeRef;
65 if(this._started){ return; }
67 // the child widget from srcNodeRef is the dropdown widget. Insert it in the page DOM,
68 // make it invisible, and store a reference to pass to the popup code.
69 if(!this.dropDown && this.dropDownContainer){
70 var dropDownNode = query("[widgetId]", this.dropDownContainer)[0];
71 this.dropDown = registry.byNode(dropDownNode);
72 delete this.dropDownContainer;
75 popup.hide(this.dropDown);
78 this.inherited(arguments);
82 // Returns whether or not we are loaded - if our dropdown has an href,
83 // then we want to check that.
84 var dropDown = this.dropDown;
85 return (!!dropDown && (!dropDown.href || dropDown.isLoaded));
88 loadDropDown: function(/*Function*/ callback){
89 // Default implementation assumes that drop down already exists,
90 // but hasn't loaded it's data (ex: ContentPane w/href).
91 // App must override if the drop down is lazy-created.
92 var dropDown = this.dropDown;
93 var handler = dropDown.on("load", lang.hitch(this, function(){
97 dropDown.refresh(); // tell it to load
100 isFocusable: function(){
101 // Overridden so that focus is handled by the _HasDropDown mixin, not by
102 // the _FormWidget mixin.
103 return this.inherited(arguments) && !this._mouseDown;