The beauty of the Store
object is in its many uses. So many objects, within the Ext JS library, can consume a Store
as part of their configuration, automatically mapping data in many cases.
For example, the ComboBox
object can take a Store
, or any of its subclasses, as a data provider for its values:
var combo = new Ext.form.ComboBox({ store: states, displayField: 'state', valueField: 'abbreviation', typeAhead: true, mode: 'remote', triggerAction: 'all', emptyText: 'Select a state...', selectOnFocus: true, applyTo: 'stateCombo' });
This ComboBox
takes a Store
object called states
, and maps its state field to the display, while mapping the abbreviation field to its underlying selected value.