if(mb){ dojo.marginBox(this.domNode, mb); if("w" in mb){ // We've explicitly set the wrapper
's width, so set
width to match. // 100% is safer than a pixel value because there may be a scroll bar with // browser/OS specific width. this.menuTableNode.style.width = "100%"; } }
summary
Overridden so that we are able to handle resizing our
internal widget. Note that this is not a "full" resize
implementation - it only works correctly if you pass it a
marginBox.
dijit.form._SelectMenu.menuTableNode
summary
dijit.form._SelectMenu.domNode
summary
dijit.form._SelectMenu.menuTableNode.style.width
summary
dijit.form.Select
type
Function
chains:
dijit.form._FormSelectWidget: (prototype)
dijit.form._FormSelectWidget: (call)
dijit._HasDropDown: (call)
mixins:
dijit._HasDropDown.prototype: (prototype)
summary
This is a "styleable" select box - it is basically a DropDownButton which
can take a <select> as its input.
dijit.form.Select.baseClass
summary
dijit.form.Select.templateString
summary
dijit.form.Select.attributeMap
type
Object
summary
Add in our style to be applied to the focus node
dijit.form.Select.required
type
Boolean
summary
Can be true or false, default is false.
dijit.form.Select.state
type
String
summary
Shows current state (ie, validation result) of input (Normal, Warning, or Error)
dijit.form.Select.message
type
String
summary
Currently displayed error/prompt message
dijit.form.Select.tooltipPosition
type
String[
summary
See description of dijit.Tooltip.defaultPosition for details on this parameter.
this.inherited(arguments); // set value from selected option if(this.options.length && !this.value && this.srcNodeRef){ var si = this.srcNodeRef.selectedIndex || 0; // || 0 needed for when srcNodeRef is not a SELECT this.value = this.options[si >= 0 ? si : 0].value; } // Create the dropDown widget this.dropDown = new dijit.form._SelectMenu({id: this.id + "_menu"}); dojo.addClass(this.dropDown.domNode, this.baseClass + "Menu");
summary
Set the value to be the first, or the selected index
if(!option.value && !option.label){ // We are a separator (no label set for it) return new dijit.MenuSeparator(); }else{ // Just a regular menu option var click = dojo.hitch(this, "_setValueAttr", option); var item = new dijit.MenuItem({ option: option, label: option.label || this.emptyLabel, onClick: click, disabled: option.disabled || false }); dijit.setWaiRole(item.focusNode, "listitem"); return item; }
summary
For the given option, return the menu item that should be
used to display it. This can be overridden as needed
if(loadMenuItems === true){ // this.inherited destroys this.dropDown's child widgets (MenuItems). // Avoid this.dropDown (Menu widget) having a pointer to a destroyed widget (which will cause // issues later in _setSelected). (see #10296) if(this.dropDown){ delete this.dropDown.focusedChild; } if(this.options.length){ this.inherited(arguments); }else{ // Drop down menu is blank but add one blank entry just so something appears on the screen // to let users know that they are no choices (mimicing native select behavior) dojo.forEach(this._getChildren(), function(child){ child.destroyRecursive(); }); var item = new dijit.MenuItem({label: " "}); this.dropDown.addChild(item); } }else{ this._updateSelection(); }
Show missing or invalid messages if appropriate, and highlight textbox field.
Used when a select is initially set to no value and the user is required to
set the value.
dojo.declare("dijit.form._SelectMenu", dijit.Menu, { // summary: // An internally-used menu for dropdown that allows us a vertical scrollbar buildRendering: function(){ // summary: // Stub in our own changes, so that our domNode is not a table // otherwise, we won't respond correctly to heights/overflows this.inherited(arguments); var o = (this.menuTableNode = this.domNode); var n = (this.domNode = dojo.create("div", {style: {overflowX: "hidden", overflowY: "scroll"}})); if(o.parentNode){ o.parentNode.replaceChild(n, o); } dojo.removeClass(o, "dijitMenuTable"); n.className = o.className + " dijitSelectMenu"; o.className = "dijitReset dijitMenuTable"; dijit.setWaiRole(o,"listbox"); dijit.setWaiRole(n,"presentation"); n.appendChild(o); },
postCreate: function(){ // summary: // stop mousemove from selecting text on IE to be consistent with other browsers
resize: function(/*Object*/ mb){ // summary: // Overridden so that we are able to handle resizing our // internal widget. Note that this is not a "full" resize // implementation - it only works correctly if you pass it a // marginBox. // // mb: Object // The margin box to set this dropdown to. if(mb){ dojo.marginBox(this.domNode, mb); if("w" in mb){ // We've explicitly set the wrapper
's width, so set
width to match. // 100% is safer than a pixel value because there may be a scroll bar with // browser/OS specific width. this.menuTableNode.style.width = "100%"; } } } });
dojo.declare("dijit.form.Select", [dijit.form._FormSelectWidget, dijit._HasDropDown], { // summary: // This is a "styleable" select box - it is basically a DropDownButton which // can take a