FilteringSelect is like an HTML SELECT tag, but is populated dynamically. It works very nicely with very large data sets because it can load and page data as needed. It also resembles ComboBox, but does not allow values outside of the provided ones.
When the user tries to submit invalid input (say if they choose an option, and the legal options change) the user gets a warning message, but the Select keeps text box input as is and also keeps the last valid submit value. If the user selects the text box and presses Escape on the keyboard, the text box reverts to the last valid value, corresponding to the hidden value. This change guarantees that you will always get a valid submit value.
First, here is a FilteringSelect with inlined data:
As with ComboBox, has a value attribute. Unlike ComboBox, this value refers to the value attribute of the <option> tag. For example, if you set the value to AL, the text "Alabama" will appear in the text box on load. If you want to change the value attribute programmatically, use
/* GeSHi (C) 2004 - 2007 Nigel McNie (http://qbnz.com/highlighter) */ .geshifilter {font-family: monospace;} .geshifilter .imp {font-weight: bold; color: red;} .geshifilter .kw1 {color: #000066; font-weight: bold;} .geshifilter .kw2 {color: #003366; font-weight: bold;} .geshifilter .kw3 {color: #000066;} .geshifilter .co1 {color: #009900; font-style: italic;} .geshifilter .coMULTI {color: #009900; font-style: italic;} .geshifilter .es0 {color: #000099; font-weight: bold;} .geshifilter .br0 {color: #66cc66;} .geshifilter .st0 {color: #3366CC;} .geshifilter .nu0 {color: #CC0000;} .geshifilter .me1 {color: #006600;} .geshifilter .re0 {color: #0066FF;}Like ComboBox FilteringSelect is dojo.data-enabled. As with all dojo.data stores, you can add an identifier field to the top level of your data. The value of the identifier field tells the store which field in your data contains the submit value. Here's an example from states.txt:
/* GeSHi (C) 2004 - 2007 Nigel McNie (http://qbnz.com/highlighter) */ .geshifilter {font-family: monospace;} .geshifilter .imp {font-weight: bold; color: red;} .geshifilter .kw1 {color: #000066; font-weight: bold;} .geshifilter .kw2 {color: #003366; font-weight: bold;} .geshifilter .kw3 {color: #000066;} .geshifilter .co1 {color: #009900; font-style: italic;} .geshifilter .coMULTI {color: #009900; font-style: italic;} .geshifilter .es0 {color: #000099; font-weight: bold;} .geshifilter .br0 {color: #66cc66;} .geshifilter .st0 {color: #3366CC;} .geshifilter .nu0 {color: #CC0000;} .geshifilter .me1 {color: #006600;} .geshifilter .re0 {color: #0066FF;}This code shows an identifier set to abbreviation. The identifier instructs the dojo.data store to set the submit value of the items in this store to the value of the attribute named abbreviation. In this example, the first item has a field named abbreviation with a value of AL. If one of your users selected that item in your FilteringSelect, the form would submit AL to your server.
Here's the corresponding FilteringSelect
The net result of the identifier is that you can easily set the submit attribute of any number of Selects using the same data without actually adding extra attributes to the Selects.
|
dijit.form.FilteringSelect
|
||
|
Attributes
|
||
| autoComplete | Boolean true |
If you type in a partial string, and then tab out of the <input> box, automatically copy the first entry displayed in the drop down list to the <input> field |
| hasDownArrow | Boolean true |
Set this textbox to have a down arrow button/td> |
| ignoreCase | Boolean true |
Does the ComboBox menu ignore case? |
| labelAttr | String searchAttr |
String Searches pattern match against this field String Optional. The text that actually appears in the drop down. If not specified, the searchAttr text is used instead. |
| labelType | String text |
"html" or "text" |
| pageSize | Integer Infinity |
Argument to data provider. Specifies number of search results per page (before hitting "next" button) |
| query | Object {} |
A query that can be passed to 'store' to initially filter the items, before doing further filtering based on searchAttr and the key. |
| searchAttr | String name |
Searches pattern match against this field |
| searchDelay | Integer 100 |
Delay in milliseconds between when user types something and we start searching based on that value |
| store | String | Reference to data provider object used by this ComboBox. |
|
Methods
|
||
| setDisplayedValue(/*String*/ label) | Set label (and corresponding value) to "label" | |
| setValue(/*String*/ value) | Set value (and corresponding label) to "value" | |
| Action | Key |
|---|---|
| Open the menu of options (filtered by current input) | Down arrow |
| Navigate through the options | Up and down arrows |
| Pick an option | Enter |
| Close the menu of options without picking one | Esc |
JAWS 8 and Window-Eyes 6 may fail to read an option when it becomes highlighted.