2 * Ext JS Library 2.2.1
\r
3 * Copyright(c) 2006-2009, Ext JS, LLC.
\r
4 * licensing@extjs.com
\r
6 * http://extjs.com/license
\r
9 Ext.onReady(function(){
\r
10 Ext.QuickTips.init();
\r
12 // simple array store
\r
13 var store = new Ext.data.SimpleStore({
\r
14 fields: ['abbr', 'state', 'nick'],
\r
15 data : Ext.exampledata.states // from states.js
\r
17 var combo = new Ext.form.ComboBox({
\r
19 displayField:'state',
\r
22 forceSelection: true,
\r
23 triggerAction: 'all',
\r
24 emptyText:'Select a state...',
\r
26 applyTo: 'local-states'
\r
29 //Simple arrays can be used directly as the store config. 1-dimensional arrays
\r
30 //will automatically be expanded (each array item will be the combo value and text)
\r
31 //and for multi-dimensional arrays, the value in index 0 of each item will be assumed
\r
32 //to be the value, while the value at index 1 is assumed to be the text. For example,
\r
33 //[['AL', 'Alabama'],['AK', 'Alaska'], etc.]. Any other values beyond index 1 within
\r
34 //each item will be ignored using this approach.
\r
35 var comboFromArray = new Ext.form.ComboBox({
\r
36 store: Ext.exampledata.states,
\r
38 forceSelection: true,
\r
39 triggerAction: 'all',
\r
40 emptyText:'Select a state...',
\r
42 applyTo: 'array-states'
\r
45 var comboWithTooltip = new Ext.form.ComboBox({
\r
46 tpl: '<tpl for="."><div ext:qtip="{state}. {nick}" class="x-combo-list-item">{state}</div></tpl>',
\r
48 displayField:'state',
\r
50 forceSelection: true,
\r
52 triggerAction: 'all',
\r
53 emptyText:'Select a state...',
\r
55 applyTo: 'local-states-with-qtip'
\r
58 var converted = new Ext.form.ComboBox({
\r
60 triggerAction: 'all',
\r
66 // Create code view Panels. Ignore.
\r
68 contentEl: 'state-combo-code',
\r
69 width: Ext.getBody().child('p').getWidth(),
\r
70 title: 'View code to create this combo',
\r
71 hideCollapseTool: true,
\r
72 titleCollapse: true,
\r
75 renderTo: 'state-combo-code-panel'
\r
78 contentEl: 'state-combo-qtip-code',
\r
80 width: Ext.getBody().child('p').getWidth(),
\r
81 title: 'View code to create this combo',
\r
82 hideCollapseTool: true,
\r
83 titleCollapse: true,
\r
86 renderTo: 'state-combo-qtip-code-panel'
\r
89 contentEl: 'array-combo-code',
\r
91 width: Ext.getBody().child('p').getWidth(),
\r
92 title: 'View code to create this combo',
\r
93 hideCollapseTool: true,
\r
94 titleCollapse: true,
\r
97 renderTo: 'array-combo-code-panel'
\r
100 contentEl: 'transformed-combo-code',
\r
102 width: Ext.getBody().child('p').getWidth(),
\r
103 title: 'View code to create this combo',
\r
104 hideCollapseTool: true,
\r
105 titleCollapse: true,
\r
108 renderTo: 'transformed-combo-code-panel'
\r