A mixin that implements the base functionality for dijit/form/ComboBox/dijit/form/FilteringSelect
All widgets that mix in dijit/form/_AutoCompleterMixin must extend dijit/form/_FormValueWidget.
See the dijit/form/_AutoCompleterMixin reference documentation for more information.
If user types 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
Mixin to the store's fetch. For example, to set the sort order of the ComboBox menu, pass:
{ sort: [{attribute:"name",descending: true}] }
To override the default queryOptions so that deep=false, do:
{ queryOptions: {ignoreCase: true, deep: false} }
One of: "first", "all" or "none".
If the ComboBox/FilteringSelect opens with the search results and the searched
string can be found, it will be highlighted. If set to "all"
then will probably want to change queryExpr
parameter to '${0}'
Highlighting is only performed when labelType
is "text", so as to not
interfere with any HTML markup an HTML label might contain.
Set true if the query should ignore case when matching possible items
This is the item returned by the dojo/store/api/Store implementation that provides the data for this ComboBox, it's the currently selected item.
The entries in the drop down list come from this attribute in the dojo.data items. If not specified, the searchAttr attribute is used instead.
Specifies how to interpret the labelAttr in the data store items. Can be "html" or "text".
Alternate to specifying a store. Id of a dijit/form/DataList widget.
Argument to data provider. Specifies maximum number of search results to return per query
A query that can be passed to store
to initially filter the items.
ComboBox overwrites any reference to the searchAttr
and sets it to the queryExpr
with the user's input substituted.
This specifies what query is sent to the data store,
based on what the user has typed. Changing this expression will modify
whether the results are only exact matches, a "starting with" match,
etc.
${0}
will be substituted for the user text.
*
is used for wildcards.
${0}*
means "starts with", *${0}*
means "contains", ${0}
means "is"
Search for items in the data store where this attribute (in the item) matches what the user typed
Delay in milliseconds between when user types something and we start searching based on that value
Reference to data provider object used by this ComboBox.
The store must accept an object hash of properties for its query. See query
and queryExpr
for details.
a11y code that puts the highlighted option in the textbox. This way screen readers will know what is happening in the menu.
Parameter | Type | Description |
---|---|---|
node | Node |
Fill in the textbox with the first item from the drop down list, and highlight the characters that were auto-completed. For example, if user typed "CA" and the drop down list appeared, the textbox would be changed to "California" and "ifornia" would be highlighted.
Parameter | Type | Description |
---|---|---|
text | String |
Parameter | Type | Description |
---|---|---|
element | DomNode |
Helper for postMixInProperties() to set this.value based on data inlined into the markup. Returns the attribute name in the item (in dijit/form/_ComboBoxDataStore) to use as the value.
Callback when a search completes.
Parameter | Type | Description |
---|---|---|
results | Object | |
query | Object | |
options | Object |
Helper function to convert a simple pattern to a regular expression for matching.
Returns a regular expression object that conforms to the defined conversion rules. For example:
and so on.
Parameter | Type | Description |
---|---|---|
pattern | dojo/string | A simple matching pattern to convert that follows basic rules:
To use a \ as a character in the string, it must be escaped. So in the pattern it should be represented by \ to be treated as an ordinary \ character instead of an escape. |
Handles input (keyboard/paste) events
Parameter | Type | Description |
---|---|---|
evt | Event |
Menu callback function, called when an item in the menu is selected.
Parameter | Type | Description |
---|---|---|
target | DomNode |
Parameter | Type | Description |
---|---|---|
element | DomNode | |
location | Number |
Parameter | Type | Description |
---|---|---|
value | Boolean |
Set the displayed valued in the input box, and the hidden value that gets submitted, based on a dojo.data store item.
Users shouldn't call this function; they should be calling set('item', value)
Parameter | Type | Description |
---|---|---|
item | item | |
priorityChange | Boolean |
Optional
|
displayedValue | String |
Optional
|
Hook so set('value', value) works.
Sets the value of the select.
Parameter | Type | Description |
---|---|---|
value | String | |
priorityChange | Boolean |
Optional
|
displayedValue | String |
Optional
|
item | item |
Optional
|
Display the drop down if not already displayed, or if it is displayed, then reposition it if necessary (reposition may be necessary if drop down's height changed).
Starts a search for elements matching key (key=="" means to return all items), and calls _openResultList() when the search completes, to display the results.
Parameter | Type | Description |
---|---|---|
key | String |
Highlights the string entered by the user in the menu. By default this highlights the first occurrence found. Override this method to implement your custom highlighting.
Parameter | Type | Description |
---|---|---|
label | String | |
find | String |
Computes the label to display based on the dojo.data store item.
Parameter | Type | Description |
---|---|---|
item | Object | The item from the store |
store | dojo/store/api/Store | The store. |
The label that the ComboBox should display
Parameter | Type | Description |
---|---|---|
callback | Function |
Subclasses must call this method from their postCreate() methods
Handles keyboard events
Parameter | Type | Description |
---|---|---|
evt | Event |
Callback when a search completes.
Parameter | Type | Description |
---|---|---|
results | Object | An array of items from the originating _SearchMixin's store. |
query | Object | A copy of the originating _SearchMixin's query property. |
options | Object | The additional parameters sent to the originating _SearchMixin's store, including: start, count, queryOptions. |