Upgrade to ExtJS 3.2.2 - Released 06/02/2010
[extjs.git] / docs / source / Combo.html
1 <html>
2 <head>
3   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    
4   <title>The source code</title>
5     <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6     <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7 </head>
8 <body  onload="prettyPrint();">
9     <pre class="prettyprint lang-js">/*!
10  * Ext JS Library 3.2.2
11  * Copyright(c) 2006-2010 Ext JS, Inc.
12  * licensing@extjs.com
13  * http://www.extjs.com/license
14  */
15 <div id="cls-Ext.form.ComboBox"></div>/**
16  * @class Ext.form.ComboBox
17  * @extends Ext.form.TriggerField
18  * <p>A combobox control with support for autocomplete, remote-loading, paging and many other features.</p>
19  * <p>A ComboBox works in a similar manner to a traditional HTML &lt;select> field. The difference is
20  * that to submit the {@link #valueField}, you must specify a {@link #hiddenName} to create a hidden input
21  * field to hold the value of the valueField. The <i>{@link #displayField}</i> is shown in the text field
22  * which is named according to the {@link #name}.</p>
23  * <p><b><u>Events</u></b></p>
24  * <p>To do something when something in ComboBox is selected, configure the select event:<pre><code>
25 var cb = new Ext.form.ComboBox({
26     // all of your config options
27     listeners:{
28          scope: yourScope,
29          'select': yourFunction
30     }
31 });
32
33 // Alternatively, you can assign events after the object is created:
34 var cb = new Ext.form.ComboBox(yourOptions);
35 cb.on('select', yourFunction, yourScope);
36  * </code></pre></p>
37  *
38  * <p><b><u>ComboBox in Grid</u></b></p>
39  * <p>If using a ComboBox in an {@link Ext.grid.EditorGridPanel Editor Grid} a {@link Ext.grid.Column#renderer renderer}
40  * will be needed to show the displayField when the editor is not active.  Set up the renderer manually, or implement
41  * a reusable render, for example:<pre><code>
42 // create reusable renderer
43 Ext.util.Format.comboRenderer = function(combo){
44     return function(value){
45         var record = combo.findRecord(combo.{@link #valueField}, value);
46         return record ? record.get(combo.{@link #displayField}) : combo.{@link #valueNotFoundText};
47     }
48 }
49
50 // create the combo instance
51 var combo = new Ext.form.ComboBox({
52     {@link #typeAhead}: true,
53     {@link #triggerAction}: 'all',
54     {@link #lazyRender}:true,
55     {@link #mode}: 'local',
56     {@link #store}: new Ext.data.ArrayStore({
57         id: 0,
58         fields: [
59             'myId',
60             'displayText'
61         ],
62         data: [[1, 'item1'], [2, 'item2']]
63     }),
64     {@link #valueField}: 'myId',
65     {@link #displayField}: 'displayText'
66 });
67
68 // snippet of column model used within grid
69 var cm = new Ext.grid.ColumnModel([{
70        ...
71     },{
72        header: "Some Header",
73        dataIndex: 'whatever',
74        width: 130,
75        editor: combo, // specify reference to combo instance
76        renderer: Ext.util.Format.comboRenderer(combo) // pass combo instance to reusable renderer
77     },
78     ...
79 ]);
80  * </code></pre></p>
81  *
82  * <p><b><u>Filtering</u></b></p>
83  * <p>A ComboBox {@link #doQuery uses filtering itself}, for information about filtering the ComboBox
84  * store manually see <tt>{@link #lastQuery}</tt>.</p>
85  * @constructor
86  * Create a new ComboBox.
87  * @param {Object} config Configuration options
88  * @xtype combo
89  */
90 Ext.form.ComboBox = Ext.extend(Ext.form.TriggerField, {
91     <div id="cfg-Ext.form.ComboBox-transform"></div>/**
92      * @cfg {Mixed} transform The id, DOM node or element of an existing HTML SELECT to convert to a ComboBox.
93      * Note that if you specify this and the combo is going to be in an {@link Ext.form.BasicForm} or
94      * {@link Ext.form.FormPanel}, you must also set <tt>{@link #lazyRender} = true</tt>.
95      */
96     <div id="cfg-Ext.form.ComboBox-lazyRender"></div>/**
97      * @cfg {Boolean} lazyRender <tt>true</tt> to prevent the ComboBox from rendering until requested
98      * (should always be used when rendering into an {@link Ext.Editor} (e.g. {@link Ext.grid.EditorGridPanel Grids}),
99      * defaults to <tt>false</tt>).
100      */
101     <div id="cfg-Ext.form.ComboBox-autoCreate"></div>/**
102      * @cfg {String/Object} autoCreate <p>A {@link Ext.DomHelper DomHelper} element spec, or <tt>true</tt> for a default
103      * element spec. Used to create the {@link Ext.Component#getEl Element} which will encapsulate this Component.
104      * See <tt>{@link Ext.Component#autoEl autoEl}</tt> for details.  Defaults to:</p>
105      * <pre><code>{tag: "input", type: "text", size: "24", autocomplete: "off"}</code></pre>
106      */
107     <div id="cfg-Ext.form.ComboBox-store"></div>/**
108      * @cfg {Ext.data.Store/Array} store The data source to which this combo is bound (defaults to <tt>undefined</tt>).
109      * Acceptable values for this property are:
110      * <div class="mdetail-params"><ul>
111      * <li><b>any {@link Ext.data.Store Store} subclass</b></li>
112      * <li><b>an Array</b> : Arrays will be converted to a {@link Ext.data.ArrayStore} internally,
113      * automatically generating {@link Ext.data.Field#name field names} to work with all data components.
114      * <div class="mdetail-params"><ul>
115      * <li><b>1-dimensional array</b> : (e.g., <tt>['Foo','Bar']</tt>)<div class="sub-desc">
116      * A 1-dimensional array will automatically be expanded (each array item will be used for both the combo
117      * {@link #valueField} and {@link #displayField})</div></li>
118      * <li><b>2-dimensional array</b> : (e.g., <tt>[['f','Foo'],['b','Bar']]</tt>)<div class="sub-desc">
119      * For a multi-dimensional array, the value in index 0 of each item will be assumed to be the combo
120      * {@link #valueField}, while the value at index 1 is assumed to be the combo {@link #displayField}.
121      * </div></li></ul></div></li></ul></div>
122      * <p>See also <tt>{@link #mode}</tt>.</p>
123      */
124     <div id="cfg-Ext.form.ComboBox-title"></div>/**
125      * @cfg {String} title If supplied, a header element is created containing this text and added into the top of
126      * the dropdown list (defaults to undefined, with no header element)
127      */
128
129     // private
130     defaultAutoCreate : {tag: "input", type: "text", size: "24", autocomplete: "off"},
131     <div id="cfg-Ext.form.ComboBox-listWidth"></div>/**
132      * @cfg {Number} listWidth The width (used as a parameter to {@link Ext.Element#setWidth}) of the dropdown
133      * list (defaults to the width of the ComboBox field).  See also <tt>{@link #minListWidth}
134      */
135     <div id="cfg-Ext.form.ComboBox-displayField"></div>/**
136      * @cfg {String} displayField The underlying {@link Ext.data.Field#name data field name} to bind to this
137      * ComboBox (defaults to undefined if <tt>{@link #mode} = 'remote'</tt> or <tt>'field1'</tt> if
138      * {@link #transform transforming a select} or if the {@link #store field name is autogenerated based on
139      * the store configuration}).
140      * <p>See also <tt>{@link #valueField}</tt>.</p>
141      * <p><b>Note</b>: if using a ComboBox in an {@link Ext.grid.EditorGridPanel Editor Grid} a
142      * {@link Ext.grid.Column#renderer renderer} will be needed to show the displayField when the editor is not
143      * active.</p>
144      */
145     <div id="cfg-Ext.form.ComboBox-valueField"></div>/**
146      * @cfg {String} valueField The underlying {@link Ext.data.Field#name data value name} to bind to this
147      * ComboBox (defaults to undefined if <tt>{@link #mode} = 'remote'</tt> or <tt>'field2'</tt> if
148      * {@link #transform transforming a select} or if the {@link #store field name is autogenerated based on
149      * the store configuration}).
150      * <p><b>Note</b>: use of a <tt>valueField</tt> requires the user to make a selection in order for a value to be
151      * mapped.  See also <tt>{@link #hiddenName}</tt>, <tt>{@link #hiddenValue}</tt>, and <tt>{@link #displayField}</tt>.</p>
152      */
153     <div id="cfg-Ext.form.ComboBox-hiddenName"></div>/**
154      * @cfg {String} hiddenName If specified, a hidden form field with this name is dynamically generated to store the
155      * field's data value (defaults to the underlying DOM element's name). Required for the combo's value to automatically
156      * post during a form submission.  See also {@link #valueField}.
157      * <p><b>Note</b>: the hidden field's id will also default to this name if {@link #hiddenId} is not specified.
158      * The ComboBox {@link Ext.Component#id id} and the <tt>{@link #hiddenId}</tt> <b>should be different</b>, since
159      * no two DOM nodes should share the same id.  So, if the ComboBox <tt>{@link Ext.form.Field#name name}</tt> and
160      * <tt>hiddenName</tt> are the same, you should specify a unique <tt>{@link #hiddenId}</tt>.</p>
161      */
162     <div id="cfg-Ext.form.ComboBox-hiddenId"></div>/**
163      * @cfg {String} hiddenId If <tt>{@link #hiddenName}</tt> is specified, <tt>hiddenId</tt> can also be provided
164      * to give the hidden field a unique id (defaults to the <tt>{@link #hiddenName}</tt>).  The <tt>hiddenId</tt>
165      * and combo {@link Ext.Component#id id} should be different, since no two DOM
166      * nodes should share the same id.
167      */
168     <div id="cfg-Ext.form.ComboBox-hiddenValue"></div>/**
169      * @cfg {String} hiddenValue Sets the initial value of the hidden field if {@link #hiddenName} is
170      * specified to contain the selected {@link #valueField}, from the Store. Defaults to the configured
171      * <tt>{@link Ext.form.Field#value value}</tt>.
172      */
173     <div id="cfg-Ext.form.ComboBox-listClass"></div>/**
174      * @cfg {String} listClass The CSS class to add to the predefined <tt>'x-combo-list'</tt> class
175      * applied the dropdown list element (defaults to '').
176      */
177     listClass : '',
178     <div id="cfg-Ext.form.ComboBox-selectedClass"></div>/**
179      * @cfg {String} selectedClass CSS class to apply to the selected item in the dropdown list
180      * (defaults to <tt>'x-combo-selected'</tt>)
181      */
182     selectedClass : 'x-combo-selected',
183     <div id="cfg-Ext.form.ComboBox-listEmptyText"></div>/**
184      * @cfg {String} listEmptyText The empty text to display in the data view if no items are found.
185      * (defaults to '')
186      */
187     listEmptyText: '',
188     <div id="cfg-Ext.form.ComboBox-triggerClass"></div>/**
189      * @cfg {String} triggerClass An additional CSS class used to style the trigger button.  The trigger will always
190      * get the class <tt>'x-form-trigger'</tt> and <tt>triggerClass</tt> will be <b>appended</b> if specified
191      * (defaults to <tt>'x-form-arrow-trigger'</tt> which displays a downward arrow icon).
192      */
193     triggerClass : 'x-form-arrow-trigger',
194     <div id="cfg-Ext.form.ComboBox-shadow"></div>/**
195      * @cfg {Boolean/String} shadow <tt>true</tt> or <tt>"sides"</tt> for the default effect, <tt>"frame"</tt> for
196      * 4-way shadow, and <tt>"drop"</tt> for bottom-right
197      */
198     shadow : 'sides',
199     <div id="cfg-Ext.form.ComboBox-listAlign"></div>/**
200      * @cfg {String/Array} listAlign A valid anchor position value. See <tt>{@link Ext.Element#alignTo}</tt> for details
201      * on supported anchor positions and offsets. To specify x/y offsets as well, this value
202      * may be specified as an Array of <tt>{@link Ext.Element#alignTo}</tt> method arguments.</p>
203      * <pre><code>[ 'tl-bl?', [6,0] ]</code></pre>(defaults to <tt>'tl-bl?'</tt>)
204      */
205     listAlign : 'tl-bl?',
206     <div id="cfg-Ext.form.ComboBox-maxHeight"></div>/**
207      * @cfg {Number} maxHeight The maximum height in pixels of the dropdown list before scrollbars are shown
208      * (defaults to <tt>300</tt>)
209      */
210     maxHeight : 300,
211     <div id="cfg-Ext.form.ComboBox-minHeight"></div>/**
212      * @cfg {Number} minHeight The minimum height in pixels of the dropdown list when the list is constrained by its
213      * distance to the viewport edges (defaults to <tt>90</tt>)
214      */
215     minHeight : 90,
216     <div id="cfg-Ext.form.ComboBox-triggerAction"></div>/**
217      * @cfg {String} triggerAction The action to execute when the trigger is clicked.
218      * <div class="mdetail-params"><ul>
219      * <li><b><tt>'query'</tt></b> : <b>Default</b>
220      * <p class="sub-desc">{@link #doQuery run the query} using the {@link Ext.form.Field#getRawValue raw value}.</p></li>
221      * <li><b><tt>'all'</tt></b> :
222      * <p class="sub-desc">{@link #doQuery run the query} specified by the <tt>{@link #allQuery}</tt> config option</p></li>
223      * </ul></div>
224      * <p>See also <code>{@link #queryParam}</code>.</p>
225      */
226     triggerAction : 'query',
227     <div id="cfg-Ext.form.ComboBox-minChars"></div>/**
228      * @cfg {Number} minChars The minimum number of characters the user must type before autocomplete and
229      * {@link #typeAhead} activate (defaults to <tt>4</tt> if <tt>{@link #mode} = 'remote'</tt> or <tt>0</tt> if
230      * <tt>{@link #mode} = 'local'</tt>, does not apply if
231      * <tt>{@link Ext.form.TriggerField#editable editable} = false</tt>).
232      */
233     minChars : 4,
234     <div id="cfg-Ext.form.ComboBox-autoSelect"></div>/**
235      * @cfg {Boolean} autoSelect <tt>true</tt> to select the first result gathered by the data store (defaults
236      * to <tt>true</tt>).  A false value would require a manual selection from the dropdown list to set the components value
237      * unless the value of ({@link #typeAheadDelay}) were true.
238      */
239     autoSelect : true,
240     <div id="cfg-Ext.form.ComboBox-typeAhead"></div>/**
241      * @cfg {Boolean} typeAhead <tt>true</tt> to populate and autoselect the remainder of the text being
242      * typed after a configurable delay ({@link #typeAheadDelay}) if it matches a known value (defaults
243      * to <tt>false</tt>)
244      */
245     typeAhead : false,
246     <div id="cfg-Ext.form.ComboBox-queryDelay"></div>/**
247      * @cfg {Number} queryDelay The length of time in milliseconds to delay between the start of typing and
248      * sending the query to filter the dropdown list (defaults to <tt>500</tt> if <tt>{@link #mode} = 'remote'</tt>
249      * or <tt>10</tt> if <tt>{@link #mode} = 'local'</tt>)
250      */
251     queryDelay : 500,
252     <div id="cfg-Ext.form.ComboBox-pageSize"></div>/**
253      * @cfg {Number} pageSize If greater than <tt>0</tt>, a {@link Ext.PagingToolbar} is displayed in the
254      * footer of the dropdown list and the {@link #doQuery filter queries} will execute with page start and
255      * {@link Ext.PagingToolbar#pageSize limit} parameters. Only applies when <tt>{@link #mode} = 'remote'</tt>
256      * (defaults to <tt>0</tt>).
257      */
258     pageSize : 0,
259     <div id="cfg-Ext.form.ComboBox-selectOnFocus"></div>/**
260      * @cfg {Boolean} selectOnFocus <tt>true</tt> to select any existing text in the field immediately on focus.
261      * Only applies when <tt>{@link Ext.form.TriggerField#editable editable} = true</tt> (defaults to
262      * <tt>false</tt>).
263      */
264     selectOnFocus : false,
265     <div id="cfg-Ext.form.ComboBox-queryParam"></div>/**
266      * @cfg {String} queryParam Name of the query ({@link Ext.data.Store#baseParam baseParam} name for the store)
267      * as it will be passed on the querystring (defaults to <tt>'query'</tt>)
268      */
269     queryParam : 'query',
270     <div id="cfg-Ext.form.ComboBox-loadingText"></div>/**
271      * @cfg {String} loadingText The text to display in the dropdown list while data is loading.  Only applies
272      * when <tt>{@link #mode} = 'remote'</tt> (defaults to <tt>'Loading...'</tt>)
273      */
274     loadingText : 'Loading...',
275     <div id="cfg-Ext.form.ComboBox-resizable"></div>/**
276      * @cfg {Boolean} resizable <tt>true</tt> to add a resize handle to the bottom of the dropdown list
277      * (creates an {@link Ext.Resizable} with 'se' {@link Ext.Resizable#pinned pinned} handles).
278      * Defaults to <tt>false</tt>.
279      */
280     resizable : false,
281     <div id="cfg-Ext.form.ComboBox-handleHeight"></div>/**
282      * @cfg {Number} handleHeight The height in pixels of the dropdown list resize handle if
283      * <tt>{@link #resizable} = true</tt> (defaults to <tt>8</tt>)
284      */
285     handleHeight : 8,
286     <div id="cfg-Ext.form.ComboBox-allQuery"></div>/**
287      * @cfg {String} allQuery The text query to send to the server to return all records for the list
288      * with no filtering (defaults to '')
289      */
290     allQuery: '',
291     <div id="cfg-Ext.form.ComboBox-mode"></div>/**
292      * @cfg {String} mode Acceptable values are:
293      * <div class="mdetail-params"><ul>
294      * <li><b><tt>'remote'</tt></b> : <b>Default</b>
295      * <p class="sub-desc">Automatically loads the <tt>{@link #store}</tt> the <b>first</b> time the trigger
296      * is clicked. If you do not want the store to be automatically loaded the first time the trigger is
297      * clicked, set to <tt>'local'</tt> and manually load the store.  To force a requery of the store
298      * <b>every</b> time the trigger is clicked see <tt>{@link #lastQuery}</tt>.</p></li>
299      * <li><b><tt>'local'</tt></b> :
300      * <p class="sub-desc">ComboBox loads local data</p>
301      * <pre><code>
302 var combo = new Ext.form.ComboBox({
303     renderTo: document.body,
304     mode: 'local',
305     store: new Ext.data.ArrayStore({
306         id: 0,
307         fields: [
308             'myId',  // numeric value is the key
309             'displayText'
310         ],
311         data: [[1, 'item1'], [2, 'item2']]  // data is local
312     }),
313     valueField: 'myId',
314     displayField: 'displayText',
315     triggerAction: 'all'
316 });
317      * </code></pre></li>
318      * </ul></div>
319      */
320     mode: 'remote',
321     <div id="cfg-Ext.form.ComboBox-minListWidth"></div>/**
322      * @cfg {Number} minListWidth The minimum width of the dropdown list in pixels (defaults to <tt>70</tt>, will
323      * be ignored if <tt>{@link #listWidth}</tt> has a higher value)
324      */
325     minListWidth : 70,
326     <div id="cfg-Ext.form.ComboBox-forceSelection"></div>/**
327      * @cfg {Boolean} forceSelection <tt>true</tt> to restrict the selected value to one of the values in the list,
328      * <tt>false</tt> to allow the user to set arbitrary text into the field (defaults to <tt>false</tt>)
329      */
330     forceSelection : false,
331     <div id="cfg-Ext.form.ComboBox-typeAheadDelay"></div>/**
332      * @cfg {Number} typeAheadDelay The length of time in milliseconds to wait until the typeahead text is displayed
333      * if <tt>{@link #typeAhead} = true</tt> (defaults to <tt>250</tt>)
334      */
335     typeAheadDelay : 250,
336     <div id="cfg-Ext.form.ComboBox-valueNotFoundText"></div>/**
337      * @cfg {String} valueNotFoundText When using a name/value combo, if the value passed to setValue is not found in
338      * the store, valueNotFoundText will be displayed as the field text if defined (defaults to undefined). If this
339      * default text is used, it means there is no value set and no validation will occur on this field.
340      */
341
342     <div id="cfg-Ext.form.ComboBox-lazyInit"></div>/**
343      * @cfg {Boolean} lazyInit <tt>true</tt> to not initialize the list for this combo until the field is focused
344      * (defaults to <tt>true</tt>)
345      */
346     lazyInit : true,
347
348     <div id="cfg-Ext.form.ComboBox-clearFilterOnReset"></div>/**
349      * @cfg {Boolean} clearFilterOnReset <tt>true</tt> to clear any filters on the store (when in local mode) when reset is called
350      * (defaults to <tt>true</tt>)
351      */
352     clearFilterOnReset : true,
353
354     <div id="cfg-Ext.form.ComboBox-submitValue"></div>/**
355      * @cfg {Boolean} submitValue False to clear the name attribute on the field so that it is not submitted during a form post.
356      * If a hiddenName is specified, setting this to true will cause both the hidden field and the element to be submitted.
357      * Defaults to <tt>undefined</tt>.
358      */
359     submitValue: undefined,
360
361     <div id="prop-Ext.form.ComboBox-lastQuery"></div>/**
362      * The value of the match string used to filter the store. Delete this property to force a requery.
363      * Example use:
364      * <pre><code>
365 var combo = new Ext.form.ComboBox({
366     ...
367     mode: 'remote',
368     ...
369     listeners: {
370         // delete the previous query in the beforequery event or set
371         // combo.lastQuery = null (this will reload the store the next time it expands)
372         beforequery: function(qe){
373             delete qe.combo.lastQuery;
374         }
375     }
376 });
377      * </code></pre>
378      * To make sure the filter in the store is not cleared the first time the ComboBox trigger is used
379      * configure the combo with <tt>lastQuery=''</tt>. Example use:
380      * <pre><code>
381 var combo = new Ext.form.ComboBox({
382     ...
383     mode: 'local',
384     triggerAction: 'all',
385     lastQuery: ''
386 });
387      * </code></pre>
388      * @property lastQuery
389      * @type String
390      */
391
392     // private
393     initComponent : function(){
394         Ext.form.ComboBox.superclass.initComponent.call(this);
395         this.addEvents(
396             <div id="event-Ext.form.ComboBox-expand"></div>/**
397              * @event expand
398              * Fires when the dropdown list is expanded
399              * @param {Ext.form.ComboBox} combo This combo box
400              */
401             'expand',
402             <div id="event-Ext.form.ComboBox-collapse"></div>/**
403              * @event collapse
404              * Fires when the dropdown list is collapsed
405              * @param {Ext.form.ComboBox} combo This combo box
406              */
407             'collapse',
408
409             <div id="event-Ext.form.ComboBox-beforeselect"></div>/**
410              * @event beforeselect
411              * Fires before a list item is selected. Return false to cancel the selection.
412              * @param {Ext.form.ComboBox} combo This combo box
413              * @param {Ext.data.Record} record The data record returned from the underlying store
414              * @param {Number} index The index of the selected item in the dropdown list
415              */
416             'beforeselect',
417             <div id="event-Ext.form.ComboBox-select"></div>/**
418              * @event select
419              * Fires when a list item is selected
420              * @param {Ext.form.ComboBox} combo This combo box
421              * @param {Ext.data.Record} record The data record returned from the underlying store
422              * @param {Number} index The index of the selected item in the dropdown list
423              */
424             'select',
425             <div id="event-Ext.form.ComboBox-beforequery"></div>/**
426              * @event beforequery
427              * Fires before all queries are processed. Return false to cancel the query or set the queryEvent's
428              * cancel property to true.
429              * @param {Object} queryEvent An object that has these properties:<ul>
430              * <li><code>combo</code> : Ext.form.ComboBox <div class="sub-desc">This combo box</div></li>
431              * <li><code>query</code> : String <div class="sub-desc">The query</div></li>
432              * <li><code>forceAll</code> : Boolean <div class="sub-desc">True to force "all" query</div></li>
433              * <li><code>cancel</code> : Boolean <div class="sub-desc">Set to true to cancel the query</div></li>
434              * </ul>
435              */
436             'beforequery'
437         );
438         if(this.transform){
439             var s = Ext.getDom(this.transform);
440             if(!this.hiddenName){
441                 this.hiddenName = s.name;
442             }
443             if(!this.store){
444                 this.mode = 'local';
445                 var d = [], opts = s.options;
446                 for(var i = 0, len = opts.length;i < len; i++){
447                     var o = opts[i],
448                         value = (o.hasAttribute ? o.hasAttribute('value') : o.getAttributeNode('value').specified) ? o.value : o.text;
449                     if(o.selected && Ext.isEmpty(this.value, true)) {
450                         this.value = value;
451                     }
452                     d.push([value, o.text]);
453                 }
454                 this.store = new Ext.data.ArrayStore({
455                     'id': 0,
456                     fields: ['value', 'text'],
457                     data : d,
458                     autoDestroy: true
459                 });
460                 this.valueField = 'value';
461                 this.displayField = 'text';
462             }
463             s.name = Ext.id(); // wipe out the name in case somewhere else they have a reference
464             if(!this.lazyRender){
465                 this.target = true;
466                 this.el = Ext.DomHelper.insertBefore(s, this.autoCreate || this.defaultAutoCreate);
467                 this.render(this.el.parentNode, s);
468             }
469             Ext.removeNode(s);
470         }
471         //auto-configure store from local array data
472         else if(this.store){
473             this.store = Ext.StoreMgr.lookup(this.store);
474             if(this.store.autoCreated){
475                 this.displayField = this.valueField = 'field1';
476                 if(!this.store.expandData){
477                     this.displayField = 'field2';
478                 }
479                 this.mode = 'local';
480             }
481         }
482
483         this.selectedIndex = -1;
484         if(this.mode == 'local'){
485             if(!Ext.isDefined(this.initialConfig.queryDelay)){
486                 this.queryDelay = 10;
487             }
488             if(!Ext.isDefined(this.initialConfig.minChars)){
489                 this.minChars = 0;
490             }
491         }
492     },
493
494     // private
495     onRender : function(ct, position){
496         if(this.hiddenName && !Ext.isDefined(this.submitValue)){
497             this.submitValue = false;
498         }
499         Ext.form.ComboBox.superclass.onRender.call(this, ct, position);
500         if(this.hiddenName){
501             this.hiddenField = this.el.insertSibling({tag:'input', type:'hidden', name: this.hiddenName,
502                     id: (this.hiddenId||this.hiddenName)}, 'before', true);
503
504         }
505         if(Ext.isGecko){
506             this.el.dom.setAttribute('autocomplete', 'off');
507         }
508
509         if(!this.lazyInit){
510             this.initList();
511         }else{
512             this.on('focus', this.initList, this, {single: true});
513         }
514     },
515
516     // private
517     initValue : function(){
518         Ext.form.ComboBox.superclass.initValue.call(this);
519         if(this.hiddenField){
520             this.hiddenField.value =
521                 Ext.value(Ext.isDefined(this.hiddenValue) ? this.hiddenValue : this.value, '');
522         }
523     },
524
525     getParentZIndex : function(){
526         var zindex;
527         if (this.ownerCt){
528             this.findParentBy(function(ct){
529                 zindex = parseInt(ct.getPositionEl().getStyle('z-index'), 10);
530                 return !!zindex;
531             });
532         }
533         return zindex;
534     },
535     
536     getZIndex : function(listParent){
537         listParent = listParent || Ext.getDom(this.getListParent() || Ext.getBody());
538         var zindex = parseInt(Ext.fly(listParent).getStyle('z-index'), 10);
539         if(!zindex){
540             zindex = this.getParentZIndex();
541         }
542         return (zindex || 12000) + 5;
543     },
544
545     // private
546     initList : function(){
547         if(!this.list){
548             var cls = 'x-combo-list',
549                 listParent = Ext.getDom(this.getListParent() || Ext.getBody());
550
551             this.list = new Ext.Layer({
552                 parentEl: listParent,
553                 shadow: this.shadow,
554                 cls: [cls, this.listClass].join(' '),
555                 constrain:false,
556                 zindex: this.getZIndex(listParent)
557             });
558
559             var lw = this.listWidth || Math.max(this.wrap.getWidth(), this.minListWidth);
560             this.list.setSize(lw, 0);
561             this.list.swallowEvent('mousewheel');
562             this.assetHeight = 0;
563             if(this.syncFont !== false){
564                 this.list.setStyle('font-size', this.el.getStyle('font-size'));
565             }
566             if(this.title){
567                 this.header = this.list.createChild({cls:cls+'-hd', html: this.title});
568                 this.assetHeight += this.header.getHeight();
569             }
570
571             this.innerList = this.list.createChild({cls:cls+'-inner'});
572             this.mon(this.innerList, 'mouseover', this.onViewOver, this);
573             this.mon(this.innerList, 'mousemove', this.onViewMove, this);
574             this.innerList.setWidth(lw - this.list.getFrameWidth('lr'));
575
576             if(this.pageSize){
577                 this.footer = this.list.createChild({cls:cls+'-ft'});
578                 this.pageTb = new Ext.PagingToolbar({
579                     store: this.store,
580                     pageSize: this.pageSize,
581                     renderTo:this.footer
582                 });
583                 this.assetHeight += this.footer.getHeight();
584             }
585
586             if(!this.tpl){
587                 <div id="cfg-Ext.form.ComboBox-tpl"></div>/**
588                 * @cfg {String/Ext.XTemplate} tpl <p>The template string, or {@link Ext.XTemplate} instance to
589                 * use to display each item in the dropdown list. The dropdown list is displayed in a
590                 * DataView. See {@link #view}.</p>
591                 * <p>The default template string is:</p><pre><code>
592                   '&lt;tpl for=".">&lt;div class="x-combo-list-item">{' + this.displayField + '}&lt;/div>&lt;/tpl>'
593                 * </code></pre>
594                 * <p>Override the default value to create custom UI layouts for items in the list.
595                 * For example:</p><pre><code>
596                   '&lt;tpl for=".">&lt;div ext:qtip="{state}. {nick}" class="x-combo-list-item">{state}&lt;/div>&lt;/tpl>'
597                 * </code></pre>
598                 * <p>The template <b>must</b> contain one or more substitution parameters using field
599                 * names from the Combo's</b> {@link #store Store}. In the example above an
600                 * <pre>ext:qtip</pre> attribute is added to display other fields from the Store.</p>
601                 * <p>To preserve the default visual look of list items, add the CSS class name
602                 * <pre>x-combo-list-item</pre> to the template's container element.</p>
603                 * <p>Also see {@link #itemSelector} for additional details.</p>
604                 */
605                 this.tpl = '<tpl for="."><div class="'+cls+'-item">{' + this.displayField + '}</div></tpl>';
606                 <div id="cfg-Ext.form.ComboBox-itemSelector"></div>/**
607                  * @cfg {String} itemSelector
608                  * <p>A simple CSS selector (e.g. div.some-class or span:first-child) that will be
609                  * used to determine what nodes the {@link #view Ext.DataView} which handles the dropdown
610                  * display will be working with.</p>
611                  * <p><b>Note</b>: this setting is <b>required</b> if a custom XTemplate has been
612                  * specified in {@link #tpl} which assigns a class other than <pre>'x-combo-list-item'</pre>
613                  * to dropdown list items</b>
614                  */
615             }
616
617             <div id="prop-Ext.form.ComboBox-view"></div>/**
618             * The {@link Ext.DataView DataView} used to display the ComboBox's options.
619             * @type Ext.DataView
620             */
621             this.view = new Ext.DataView({
622                 applyTo: this.innerList,
623                 tpl: this.tpl,
624                 singleSelect: true,
625                 selectedClass: this.selectedClass,
626                 itemSelector: this.itemSelector || '.' + cls + '-item',
627                 emptyText: this.listEmptyText,
628                 deferEmptyText: false
629             });
630
631             this.mon(this.view, {
632                 containerclick : this.onViewClick,
633                 click : this.onViewClick,
634                 scope :this
635             });
636
637             this.bindStore(this.store, true);
638
639             if(this.resizable){
640                 this.resizer = new Ext.Resizable(this.list,  {
641                    pinned:true, handles:'se'
642                 });
643                 this.mon(this.resizer, 'resize', function(r, w, h){
644                     this.maxHeight = h-this.handleHeight-this.list.getFrameWidth('tb')-this.assetHeight;
645                     this.listWidth = w;
646                     this.innerList.setWidth(w - this.list.getFrameWidth('lr'));
647                     this.restrictHeight();
648                 }, this);
649
650                 this[this.pageSize?'footer':'innerList'].setStyle('margin-bottom', this.handleHeight+'px');
651             }
652         }
653     },
654
655     <div id="method-Ext.form.ComboBox-getListParent"></div>/**
656      * <p>Returns the element used to house this ComboBox's pop-up list. Defaults to the document body.</p>
657      * A custom implementation may be provided as a configuration option if the floating list needs to be rendered
658      * to a different Element. An example might be rendering the list inside a Menu so that clicking
659      * the list does not hide the Menu:<pre><code>
660 var store = new Ext.data.ArrayStore({
661     autoDestroy: true,
662     fields: ['initials', 'fullname'],
663     data : [
664         ['FF', 'Fred Flintstone'],
665         ['BR', 'Barney Rubble']
666     ]
667 });
668
669 var combo = new Ext.form.ComboBox({
670     store: store,
671     displayField: 'fullname',
672     emptyText: 'Select a name...',
673     forceSelection: true,
674     getListParent: function() {
675         return this.el.up('.x-menu');
676     },
677     iconCls: 'no-icon', //use iconCls if placing within menu to shift to right side of menu
678     mode: 'local',
679     selectOnFocus: true,
680     triggerAction: 'all',
681     typeAhead: true,
682     width: 135
683 });
684
685 var menu = new Ext.menu.Menu({
686     id: 'mainMenu',
687     items: [
688         combo // A Field in a Menu
689     ]
690 });
691 </code></pre>
692      */
693     getListParent : function() {
694         return document.body;
695     },
696
697     <div id="method-Ext.form.ComboBox-getStore"></div>/**
698      * Returns the store associated with this combo.
699      * @return {Ext.data.Store} The store
700      */
701     getStore : function(){
702         return this.store;
703     },
704
705     // private
706     bindStore : function(store, initial){
707         if(this.store && !initial){
708             if(this.store !== store && this.store.autoDestroy){
709                 this.store.destroy();
710             }else{
711                 this.store.un('beforeload', this.onBeforeLoad, this);
712                 this.store.un('load', this.onLoad, this);
713                 this.store.un('exception', this.collapse, this);
714             }
715             if(!store){
716                 this.store = null;
717                 if(this.view){
718                     this.view.bindStore(null);
719                 }
720                 if(this.pageTb){
721                     this.pageTb.bindStore(null);
722                 }
723             }
724         }
725         if(store){
726             if(!initial) {
727                 this.lastQuery = null;
728                 if(this.pageTb) {
729                     this.pageTb.bindStore(store);
730                 }
731             }
732
733             this.store = Ext.StoreMgr.lookup(store);
734             this.store.on({
735                 scope: this,
736                 beforeload: this.onBeforeLoad,
737                 load: this.onLoad,
738                 exception: this.collapse
739             });
740
741             if(this.view){
742                 this.view.bindStore(store);
743             }
744         }
745     },
746
747     reset : function(){
748         Ext.form.ComboBox.superclass.reset.call(this);
749         if(this.clearFilterOnReset && this.mode == 'local'){
750             this.store.clearFilter();
751         }
752     },
753
754     // private
755     initEvents : function(){
756         Ext.form.ComboBox.superclass.initEvents.call(this);
757
758         <div id="prop-Ext.form.ComboBox-keyNav"></div>/**
759          * @property keyNav
760          * @type Ext.KeyNav
761          * <p>A {@link Ext.KeyNav KeyNav} object which handles navigation keys for this ComboBox. This performs actions
762          * based on keystrokes typed when the input field is focused.</p>
763          * <p><b>After the ComboBox has been rendered</b>, you may override existing navigation key functionality,
764          * or add your own based upon key names as specified in the {@link Ext.KeyNav KeyNav} class.</p>
765          * <p>The function is executed in the scope (<code>this</code> reference of the ComboBox. Example:</p><pre><code>
766 myCombo.keyNav.esc = function(e) {  // Override ESC handling function
767     this.collapse();                // Standard behaviour of Ext's ComboBox.
768     this.setValue(this.startValue); // We reset to starting value on ESC
769 };
770 myCombo.keyNav.tab = function() {   // Override TAB handling function
771     this.onViewClick(false);        // Select the currently highlighted row
772 };
773 </code></pre>
774          */
775         this.keyNav = new Ext.KeyNav(this.el, {
776             "up" : function(e){
777                 this.inKeyMode = true;
778                 this.selectPrev();
779             },
780
781             "down" : function(e){
782                 if(!this.isExpanded()){
783                     this.onTriggerClick();
784                 }else{
785                     this.inKeyMode = true;
786                     this.selectNext();
787                 }
788             },
789
790             "enter" : function(e){
791                 this.onViewClick();
792             },
793
794             "esc" : function(e){
795                 this.collapse();
796             },
797
798             "tab" : function(e){
799                 if (this.forceSelection === true) {
800                     this.collapse();
801                 } else {
802                     this.onViewClick(false);
803                 }
804                 return true;
805             },
806
807             scope : this,
808
809             doRelay : function(e, h, hname){
810                 if(hname == 'down' || this.scope.isExpanded()){
811                     // this MUST be called before ComboBox#fireKey()
812                     var relay = Ext.KeyNav.prototype.doRelay.apply(this, arguments);
813                     if(!Ext.isIE && Ext.EventManager.useKeydown){
814                         // call Combo#fireKey() for browsers which use keydown event (except IE)
815                         this.scope.fireKey(e);
816                     }
817                     return relay;
818                 }
819                 return true;
820             },
821
822             forceKeyDown : true,
823             defaultEventAction: 'stopEvent'
824         });
825         this.queryDelay = Math.max(this.queryDelay || 10,
826                 this.mode == 'local' ? 10 : 250);
827         this.dqTask = new Ext.util.DelayedTask(this.initQuery, this);
828         if(this.typeAhead){
829             this.taTask = new Ext.util.DelayedTask(this.onTypeAhead, this);
830         }
831         if(!this.enableKeyEvents){
832             this.mon(this.el, 'keyup', this.onKeyUp, this);
833         }
834     },
835
836
837     // private
838     onDestroy : function(){
839         if (this.dqTask){
840             this.dqTask.cancel();
841             this.dqTask = null;
842         }
843         this.bindStore(null);
844         Ext.destroy(
845             this.resizer,
846             this.view,
847             this.pageTb,
848             this.list
849         );
850         Ext.destroyMembers(this, 'hiddenField');
851         Ext.form.ComboBox.superclass.onDestroy.call(this);
852     },
853
854     // private
855     fireKey : function(e){
856         if (!this.isExpanded()) {
857             Ext.form.ComboBox.superclass.fireKey.call(this, e);
858         }
859     },
860
861     // private
862     onResize : function(w, h){
863         Ext.form.ComboBox.superclass.onResize.apply(this, arguments);
864         if(!isNaN(w) && this.isVisible() && this.list){
865             this.doResize(w);
866         }else{
867             this.bufferSize = w;
868         }
869     },
870
871     doResize: function(w){
872         if(!Ext.isDefined(this.listWidth)){
873             var lw = Math.max(w, this.minListWidth);
874             this.list.setWidth(lw);
875             this.innerList.setWidth(lw - this.list.getFrameWidth('lr'));
876         }
877     },
878
879     // private
880     onEnable : function(){
881         Ext.form.ComboBox.superclass.onEnable.apply(this, arguments);
882         if(this.hiddenField){
883             this.hiddenField.disabled = false;
884         }
885     },
886
887     // private
888     onDisable : function(){
889         Ext.form.ComboBox.superclass.onDisable.apply(this, arguments);
890         if(this.hiddenField){
891             this.hiddenField.disabled = true;
892         }
893     },
894
895     // private
896     onBeforeLoad : function(){
897         if(!this.hasFocus){
898             return;
899         }
900         this.innerList.update(this.loadingText ?
901                '<div class="loading-indicator">'+this.loadingText+'</div>' : '');
902         this.restrictHeight();
903         this.selectedIndex = -1;
904     },
905
906     // private
907     onLoad : function(){
908         if(!this.hasFocus){
909             return;
910         }
911         if(this.store.getCount() > 0 || this.listEmptyText){
912             this.expand();
913             this.restrictHeight();
914             if(this.lastQuery == this.allQuery){
915                 if(this.editable){
916                     this.el.dom.select();
917                 }
918
919                 if(this.autoSelect !== false && !this.selectByValue(this.value, true)){
920                     this.select(0, true);
921                 }
922             }else{
923                 if(this.autoSelect !== false){
924                     this.selectNext();
925                 }
926                 if(this.typeAhead && this.lastKey != Ext.EventObject.BACKSPACE && this.lastKey != Ext.EventObject.DELETE){
927                     this.taTask.delay(this.typeAheadDelay);
928                 }
929             }
930         }else{
931             this.collapse();
932         }
933
934     },
935
936     // private
937     onTypeAhead : function(){
938         if(this.store.getCount() > 0){
939             var r = this.store.getAt(0);
940             var newValue = r.data[this.displayField];
941             var len = newValue.length;
942             var selStart = this.getRawValue().length;
943             if(selStart != len){
944                 this.setRawValue(newValue);
945                 this.selectText(selStart, newValue.length);
946             }
947         }
948     },
949
950     // private
951     assertValue  : function(){
952         var val = this.getRawValue(),
953             rec = this.findRecord(this.displayField, val);
954
955         if(!rec && this.forceSelection){
956             if(val.length > 0 && val != this.emptyText){
957                 this.el.dom.value = Ext.value(this.lastSelectionText, '');
958                 this.applyEmptyText();
959             }else{
960                 this.clearValue();
961             }
962         }else{
963             if(rec){
964                 // onSelect may have already set the value and by doing so
965                 // set the display field properly.  Let's not wipe out the
966                 // valueField here by just sending the displayField.
967                 if (val == rec.get(this.displayField) && this.value == rec.get(this.valueField)){
968                     return;
969                 }
970                 val = rec.get(this.valueField || this.displayField);
971             }
972             this.setValue(val);
973         }
974     },
975
976     // private
977     onSelect : function(record, index){
978         if(this.fireEvent('beforeselect', this, record, index) !== false){
979             this.setValue(record.data[this.valueField || this.displayField]);
980             this.collapse();
981             this.fireEvent('select', this, record, index);
982         }
983     },
984
985     // inherit docs
986     getName: function(){
987         var hf = this.hiddenField;
988         return hf && hf.name ? hf.name : this.hiddenName || Ext.form.ComboBox.superclass.getName.call(this);
989     },
990
991     <div id="method-Ext.form.ComboBox-getValue"></div>/**
992      * Returns the currently selected field value or empty string if no value is set.
993      * @return {String} value The selected value
994      */
995     getValue : function(){
996         if(this.valueField){
997             return Ext.isDefined(this.value) ? this.value : '';
998         }else{
999             return Ext.form.ComboBox.superclass.getValue.call(this);
1000         }
1001     },
1002
1003     <div id="method-Ext.form.ComboBox-clearValue"></div>/**
1004      * Clears any text/value currently set in the field
1005      */
1006     clearValue : function(){
1007         if(this.hiddenField){
1008             this.hiddenField.value = '';
1009         }
1010         this.setRawValue('');
1011         this.lastSelectionText = '';
1012         this.applyEmptyText();
1013         this.value = '';
1014     },
1015
1016     <div id="method-Ext.form.ComboBox-setValue"></div>/**
1017      * Sets the specified value into the field.  If the value finds a match, the corresponding record text
1018      * will be displayed in the field.  If the value does not match the data value of an existing item,
1019      * and the valueNotFoundText config option is defined, it will be displayed as the default field text.
1020      * Otherwise the field will be blank (although the value will still be set).
1021      * @param {String} value The value to match
1022      * @return {Ext.form.Field} this
1023      */
1024     setValue : function(v){
1025         var text = v;
1026         if(this.valueField){
1027             var r = this.findRecord(this.valueField, v);
1028             if(r){
1029                 text = r.data[this.displayField];
1030             }else if(Ext.isDefined(this.valueNotFoundText)){
1031                 text = this.valueNotFoundText;
1032             }
1033         }
1034         this.lastSelectionText = text;
1035         if(this.hiddenField){
1036             this.hiddenField.value = Ext.value(v, '');
1037         }
1038         Ext.form.ComboBox.superclass.setValue.call(this, text);
1039         this.value = v;
1040         return this;
1041     },
1042
1043     // private
1044     findRecord : function(prop, value){
1045         var record;
1046         if(this.store.getCount() > 0){
1047             this.store.each(function(r){
1048                 if(r.data[prop] == value){
1049                     record = r;
1050                     return false;
1051                 }
1052             });
1053         }
1054         return record;
1055     },
1056
1057     // private
1058     onViewMove : function(e, t){
1059         this.inKeyMode = false;
1060     },
1061
1062     // private
1063     onViewOver : function(e, t){
1064         if(this.inKeyMode){ // prevent key nav and mouse over conflicts
1065             return;
1066         }
1067         var item = this.view.findItemFromChild(t);
1068         if(item){
1069             var index = this.view.indexOf(item);
1070             this.select(index, false);
1071         }
1072     },
1073
1074     // private
1075     onViewClick : function(doFocus){
1076         var index = this.view.getSelectedIndexes()[0],
1077             s = this.store,
1078             r = s.getAt(index);
1079         if(r){
1080             this.onSelect(r, index);
1081         }else {
1082             this.collapse();
1083         }
1084         if(doFocus !== false){
1085             this.el.focus();
1086         }
1087     },
1088
1089
1090     // private
1091     restrictHeight : function(){
1092         this.innerList.dom.style.height = '';
1093         var inner = this.innerList.dom,
1094             pad = this.list.getFrameWidth('tb') + (this.resizable ? this.handleHeight : 0) + this.assetHeight,
1095             h = Math.max(inner.clientHeight, inner.offsetHeight, inner.scrollHeight),
1096             ha = this.getPosition()[1]-Ext.getBody().getScroll().top,
1097             hb = Ext.lib.Dom.getViewHeight()-ha-this.getSize().height,
1098             space = Math.max(ha, hb, this.minHeight || 0)-this.list.shadowOffset-pad-5;
1099
1100         h = Math.min(h, space, this.maxHeight);
1101
1102         this.innerList.setHeight(h);
1103         this.list.beginUpdate();
1104         this.list.setHeight(h+pad);
1105         this.list.alignTo.apply(this.list, [this.el].concat(this.listAlign));
1106         this.list.endUpdate();
1107     },
1108
1109     <div id="method-Ext.form.ComboBox-isExpanded"></div>/**
1110      * Returns true if the dropdown list is expanded, else false.
1111      */
1112     isExpanded : function(){
1113         return this.list && this.list.isVisible();
1114     },
1115
1116     <div id="method-Ext.form.ComboBox-selectByValue"></div>/**
1117      * Select an item in the dropdown list by its data value. This function does NOT cause the select event to fire.
1118      * The store must be loaded and the list expanded for this function to work, otherwise use setValue.
1119      * @param {String} value The data value of the item to select
1120      * @param {Boolean} scrollIntoView False to prevent the dropdown list from autoscrolling to display the
1121      * selected item if it is not currently in view (defaults to true)
1122      * @return {Boolean} True if the value matched an item in the list, else false
1123      */
1124     selectByValue : function(v, scrollIntoView){
1125         if(!Ext.isEmpty(v, true)){
1126             var r = this.findRecord(this.valueField || this.displayField, v);
1127             if(r){
1128                 this.select(this.store.indexOf(r), scrollIntoView);
1129                 return true;
1130             }
1131         }
1132         return false;
1133     },
1134
1135     <div id="method-Ext.form.ComboBox-select"></div>/**
1136      * Select an item in the dropdown list by its numeric index in the list. This function does NOT cause the select event to fire.
1137      * The store must be loaded and the list expanded for this function to work, otherwise use setValue.
1138      * @param {Number} index The zero-based index of the list item to select
1139      * @param {Boolean} scrollIntoView False to prevent the dropdown list from autoscrolling to display the
1140      * selected item if it is not currently in view (defaults to true)
1141      */
1142     select : function(index, scrollIntoView){
1143         this.selectedIndex = index;
1144         this.view.select(index);
1145         if(scrollIntoView !== false){
1146             var el = this.view.getNode(index);
1147             if(el){
1148                 this.innerList.scrollChildIntoView(el, false);
1149             }
1150         }
1151
1152     },
1153
1154     // private
1155     selectNext : function(){
1156         var ct = this.store.getCount();
1157         if(ct > 0){
1158             if(this.selectedIndex == -1){
1159                 this.select(0);
1160             }else if(this.selectedIndex < ct-1){
1161                 this.select(this.selectedIndex+1);
1162             }
1163         }
1164     },
1165
1166     // private
1167     selectPrev : function(){
1168         var ct = this.store.getCount();
1169         if(ct > 0){
1170             if(this.selectedIndex == -1){
1171                 this.select(0);
1172             }else if(this.selectedIndex !== 0){
1173                 this.select(this.selectedIndex-1);
1174             }
1175         }
1176     },
1177
1178     // private
1179     onKeyUp : function(e){
1180         var k = e.getKey();
1181         if(this.editable !== false && this.readOnly !== true && (k == e.BACKSPACE || !e.isSpecialKey())){
1182
1183             this.lastKey = k;
1184             this.dqTask.delay(this.queryDelay);
1185         }
1186         Ext.form.ComboBox.superclass.onKeyUp.call(this, e);
1187     },
1188
1189     // private
1190     validateBlur : function(){
1191         return !this.list || !this.list.isVisible();
1192     },
1193
1194     // private
1195     initQuery : function(){
1196         this.doQuery(this.getRawValue());
1197     },
1198
1199     // private
1200     beforeBlur : function(){
1201         this.assertValue();
1202     },
1203
1204     // private
1205     postBlur  : function(){
1206         Ext.form.ComboBox.superclass.postBlur.call(this);
1207         this.collapse();
1208         this.inKeyMode = false;
1209     },
1210
1211     <div id="method-Ext.form.ComboBox-doQuery"></div>/**
1212      * Execute a query to filter the dropdown list.  Fires the {@link #beforequery} event prior to performing the
1213      * query allowing the query action to be canceled if needed.
1214      * @param {String} query The SQL query to execute
1215      * @param {Boolean} forceAll <tt>true</tt> to force the query to execute even if there are currently fewer
1216      * characters in the field than the minimum specified by the <tt>{@link #minChars}</tt> config option.  It
1217      * also clears any filter previously saved in the current store (defaults to <tt>false</tt>)
1218      */
1219     doQuery : function(q, forceAll){
1220         q = Ext.isEmpty(q) ? '' : q;
1221         var qe = {
1222             query: q,
1223             forceAll: forceAll,
1224             combo: this,
1225             cancel:false
1226         };
1227         if(this.fireEvent('beforequery', qe)===false || qe.cancel){
1228             return false;
1229         }
1230         q = qe.query;
1231         forceAll = qe.forceAll;
1232         if(forceAll === true || (q.length >= this.minChars)){
1233             if(this.lastQuery !== q){
1234                 this.lastQuery = q;
1235                 if(this.mode == 'local'){
1236                     this.selectedIndex = -1;
1237                     if(forceAll){
1238                         this.store.clearFilter();
1239                     }else{
1240                         this.store.filter(this.displayField, q);
1241                     }
1242                     this.onLoad();
1243                 }else{
1244                     this.store.baseParams[this.queryParam] = q;
1245                     this.store.load({
1246                         params: this.getParams(q)
1247                     });
1248                     this.expand();
1249                 }
1250             }else{
1251                 this.selectedIndex = -1;
1252                 this.onLoad();
1253             }
1254         }
1255     },
1256
1257     // private
1258     getParams : function(q){
1259         var p = {};
1260         //p[this.queryParam] = q;
1261         if(this.pageSize){
1262             p.start = 0;
1263             p.limit = this.pageSize;
1264         }
1265         return p;
1266     },
1267
1268     <div id="method-Ext.form.ComboBox-collapse"></div>/**
1269      * Hides the dropdown list if it is currently expanded. Fires the {@link #collapse} event on completion.
1270      */
1271     collapse : function(){
1272         if(!this.isExpanded()){
1273             return;
1274         }
1275         this.list.hide();
1276         Ext.getDoc().un('mousewheel', this.collapseIf, this);
1277         Ext.getDoc().un('mousedown', this.collapseIf, this);
1278         this.fireEvent('collapse', this);
1279     },
1280
1281     // private
1282     collapseIf : function(e){
1283         if(!this.isDestroyed && !e.within(this.wrap) && !e.within(this.list)){
1284             this.collapse();
1285         }
1286     },
1287
1288     <div id="method-Ext.form.ComboBox-expand"></div>/**
1289      * Expands the dropdown list if it is currently hidden. Fires the {@link #expand} event on completion.
1290      */
1291     expand : function(){
1292         if(this.isExpanded() || !this.hasFocus){
1293             return;
1294         }
1295
1296         if(this.title || this.pageSize){
1297             this.assetHeight = 0;
1298             if(this.title){
1299                 this.assetHeight += this.header.getHeight();
1300             }
1301             if(this.pageSize){
1302                 this.assetHeight += this.footer.getHeight();
1303             }
1304         }
1305
1306         if(this.bufferSize){
1307             this.doResize(this.bufferSize);
1308             delete this.bufferSize;
1309         }
1310         this.list.alignTo.apply(this.list, [this.el].concat(this.listAlign));
1311
1312         // zindex can change, re-check it and set it if necessary
1313         this.list.setZIndex(this.getZIndex());
1314         this.list.show();
1315         if(Ext.isGecko2){
1316             this.innerList.setOverflow('auto'); // necessary for FF 2.0/Mac
1317         }
1318         this.mon(Ext.getDoc(), {
1319             scope: this,
1320             mousewheel: this.collapseIf,
1321             mousedown: this.collapseIf
1322         });
1323         this.fireEvent('expand', this);
1324     },
1325
1326     <div id="method-Ext.form.ComboBox-onTriggerClick"></div>/**
1327      * @method onTriggerClick
1328      * @hide
1329      */
1330     // private
1331     // Implements the default empty TriggerField.onTriggerClick function
1332     onTriggerClick : function(){
1333         if(this.readOnly || this.disabled){
1334             return;
1335         }
1336         if(this.isExpanded()){
1337             this.collapse();
1338             this.el.focus();
1339         }else {
1340             this.onFocus({});
1341             if(this.triggerAction == 'all') {
1342                 this.doQuery(this.allQuery, true);
1343             } else {
1344                 this.doQuery(this.getRawValue());
1345             }
1346             this.el.focus();
1347         }
1348     }
1349
1350     <div id="method-Ext.form.ComboBox-autoSize"></div>/**
1351      * @hide
1352      * @method autoSize
1353      */
1354     <div id="cfg-Ext.form.ComboBox-grow"></div>/**
1355      * @cfg {Boolean} grow @hide
1356      */
1357     <div id="cfg-Ext.form.ComboBox-growMin"></div>/**
1358      * @cfg {Number} growMin @hide
1359      */
1360     <div id="cfg-Ext.form.ComboBox-growMax"></div>/**
1361      * @cfg {Number} growMax @hide
1362      */
1363
1364 });
1365 Ext.reg('combo', Ext.form.ComboBox);
1366 </pre>    
1367 </body>
1368 </html>