Properties Methods Events Config Options Direct Link
Observable
  Component
    BoxComponent
      Field
        TextField
          TriggerField
            ComboBox

Class CQ.Ext.form.ComboBox

Package:CQ.Ext.form
Class:ComboBox
Subclasses:TimeField, ClearableComboBox, PathCompletion, PathField, SearchField, SuggestField, WorkflowModelCombo
Extends:CQ.Ext.form.TriggerField
Clientlib:cq.widgets
xtype:combo

A combobox control with support for autocomplete, remote-loading, paging and many other features.

A ComboBox works in a similar manner to a traditional HTML <select> field. The difference is that to submit the valueField, you must specify a hiddenName to create a hidden input field to hold the value of the valueField. The displayField is shown in the text field which is named according to the name.

Events

To do something when something in ComboBox is selected, configure the select event:

var cb = new CQ.Ext.form.ComboBox({
    // all of your config options
    listeners:{
         scope: yourScope,
         'select': yourFunction
    }
});

// Alternatively, you can assign events after the object is created:
var cb = new CQ.Ext.form.ComboBox(yourOptions);
cb.on('select', yourFunction, yourScope);

ComboBox in Grid

If using a ComboBox in an Editor Grid a renderer will be needed to show the displayField when the editor is not active. Set up the renderer manually, or implement a reusable render, for example:

// create reusable renderer
CQ.Ext.util.Format.comboRenderer = function(combo){
    return function(value){
        var record = combo.findRecord(combo.valueField, value);
        return record ? record.get(combo.displayField) : combo.valueNotFoundText;
    }
}

// create the combo instance
var combo = new CQ.Ext.form.ComboBox({
    typeAhead: true,
    triggerAction: 'all',
    lazyRender:true,
    mode: 'local',
    store: new CQ.Ext.data.ArrayStore({
        id: 0,
        fields: [
            'myId',
            'displayText'
        ],
        data: [[1, 'item1'], [2, 'item2']]
    }),
    valueField: 'myId',
    displayField: 'displayText'
});

// snippet of column model used within grid
var cm = new CQ.Ext.grid.ColumnModel([{
       ...
    },{
       header: "Some Header",
       dataIndex: 'whatever',
       width: 130,
       editor: combo, // specify reference to combo instance
       renderer: CQ.Ext.util.Format.comboRenderer(combo) // pass combo instance to reusable renderer
    },
    ...
]);

Filtering

A ComboBox uses filtering itself, for information about filtering the ComboBox store manually see lastQuery.

Config Options

Config Options Defined By
  allQuery : String
The text query to send to the server to return all records for the list with no filtering (defaults to '')
ComboBox
  allowDomMove : Boolean
Whether the component can move the Dom node when rendering (defaults to true).
Component
  anyMatch : Boolean
True to match any part in the autocompletion not just the beginning (defaults to false) (Note: CQ.Ext override)
ComboBox
  disabled : Boolean
Render this component disabled (default is false).
Component
  disabledClass : String
CSS class added to the component when it is disabled (defaults to 'x-item-disabled').
Component
  fieldClass : String
The default CSS class for the field (defaults to 'x-form-field')
Field
  focusClass : String
The CSS class to use when the field receives focus (defaults to 'x-form-focus')
Field
  invalidClass : String
The CSS class to use when marking a field invalid (defaults to 'x-form-invalid')
Field
  listEmptyText : String
The empty text to display in the data view if no items are found. (defaults to '')
ComboBox
  pageX : Number
The page level x coordinate for this component if contained within a positioning container.
BoxComponent
  pageY : Number
The page level y coordinate for this component if contained within a positioning container.
BoxComponent
  validateOnBlur : Boolean
Whether the field should validate when it loses focus (defaults to true).
Field
  validationDelay : Number
The length of time in milliseconds after user input begins until validation is initiated (defaults to 250)
Field
  validationEvent : String/Boolean
The event that should initiate field validation. Set to false to disable automatic validation (defaults to 'keyup').
Field
  value : Mixed
A value to initialize this field with (defaults to undefined).
Field
  x : Number
The local x (left) coordinate for this component if contained within a positioning container.
BoxComponent
  y : Number
The local y (top) coordinate for this component if contained within a positioning container.
BoxComponent

Public Properties

Property Defined By
  disabled : Boolean
True if this component is disabled. Read-only.
Component
  hidden : Boolean
True if this component is hidden. Read-only.
Component
  initialConfig : Object
This Component's initial configuration specification. Read-only.
Component
  keyNav : CQ.Ext.KeyNav

A

ComboBox
  refOwner : CQ.Ext.Container The
Component
  rendered : Boolean
True if this component has been rendered. Read-only.
Component
  view : CQ.Ext.DataView
The DataView used to display the ComboBox's options.
ComboBox

Public Methods

Method Defined By

Public Events

Event Defined By