FilteringSelect

A FilteringSelect is an enhanced version of the ordinary HTML select element in that provides a drop-down list of mandatory values and submits the hidden values and the displayed values. While FilteringSelect looks like and shares a lot of features with ComboBox, including the ability to filter a drop-down list as text is typed and the ability to fetch data from a serve via a store, it is built upon an HTML SELECT element.

Three particularly important distinctions between a FilteringSelect and a ComboBox are worth noting:

  • ComboBox is built on an ordinary select element in which the value that is submitted to the server on a submit event is the control's hidden value, not the visible value in the control. This distinction is an important feature because FilteringSelect can be degradable and behave as much like an ordinary SELECT as possible.

  • The FilteringSelect inherits from MappedTextBox (a serializable TextBox ) instead of ValidationTextBox because validation is a nonissue because users cannot type free text into the control.

  • FilteringSelect can display HTML as its label, not just text. Thus, you can include customizable markup such as images in labels.

In addition to common dijit.form operations such as getValue, setValue, getDisplayedValue, setDisplayedValue, and the various ComboBox options, FilteringSelect provides two additional attributes and one additional function, listed in Table 13-10.

Table 13-10. FilteringSelect additions

Name

Comment

labelAttr

The text to display in the control. If no value is specified, then searchAttr is used.

labelType

Whether to treat the text label as markup or ordinary text. Valid values include 'text' or 'html'.

labelFunc (/*Object*/ item, /*dojo.data.store*/ store)

The event handler that is called when the label changes; returns the label that should be displayed.

Get Dojo: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.