BoxSelects

The js is not minified so it is readable. See boxselect.js to view the code for these examples.

Ext.ux.form.field.BoxSelect extends Ext.form.field.ComboBox to provide a more 'multiSelect'-friendly control. The careful efforts made in this extension enable most (if not all) of the ComboBox examples to convert to BoxSelects easily. The examples included here showcase the differences between the default control and this extension.

Basic Configuration

All configuration values for ComboBox should work, but some defaults are changed:

Single Select

While the primary use case for BoxSelect is for multiple selection, single selection can also be set with multiSelect: false. If you want this to be the default case for all BoxSelect's, you can do so by adding the following before your BoxSelects are created:

Ext.ux.form.field.BoxSelect.prototype.multiSelect = false;

Automatic querying of remote stores for unknown values

If queryMode is set to 'remote', forceSelection is set to true, and a value is passed to the BoxSelect that is not in the store, a query will be sent to the store's configured proxy with a parameter with the name of the valueField, and a value of the unknown values separated by the configured delimiter. For example if the valueField is 'exampleIdField' and the delimiter is ', ' and unknown values '17' and '3281' are set, the following parameters will be passed to store.load():

{ exampleIdField: '17, 3281' }

This attempt to load the unknown values will be performed only once per initValue/setValue call. Any records that are still unknown after this request will be removed from the field's value, but all known values will be retained.

forceSelection: false -- Multiple Emails with Auto-suggest

The combo below illustrates the usage of 'forceSelection: false' with the BoxSelect component to enable the entry of multiple email addresses, with auto-suggestions provided from the attached store. New records are created using the user input for both the configured displayField and valueField. These new records are not added to the combo's store automatically.

There are three methods of determining when a new entry will be created:

Other configuration options

The following configuration options are specific to the BoxSelect.

Value setting and events

The following shows examples of manually managing the values of the field and displays the value-based events. Except where noted, the mixedValue parameters can be specified in any of the forms listed in the Basic Configuration examples above. In general, getRawValue and setRawValue should not be used, as of ExtJS 4 they are formally for the rendered field output only.