3 * Copyright(c) 2006-2009 Ext JS, LLC
5 * http://www.extjs.com/license
7 Ext.onReady(function(){
11 var store = new Ext.data.ArrayStore({
12 fields: ['abbr', 'state', 'nick'],
13 data : Ext.exampledata.states // from states.js
15 var combo = new Ext.form.ComboBox({
22 emptyText:'Select a state...',
24 applyTo: 'local-states'
27 //Simple arrays can be used directly as the store config. 1-dimensional arrays
28 //will automatically be expanded (each array item will be the combo value and text)
29 //and for multi-dimensional arrays, the value in index 0 of each item will be assumed
30 //to be the value, while the value at index 1 is assumed to be the text. For example,
31 //[['AL', 'Alabama'],['AK', 'Alaska'], etc.]. Any other values beyond index 1 within
32 //each item will be ignored using this approach.
33 var comboFromArray = new Ext.form.ComboBox({
34 store: Ext.exampledata.states,
38 emptyText:'Select a state...',
40 applyTo: 'array-states'
43 var comboWithTooltip = new Ext.form.ComboBox({
44 tpl: '<tpl for="."><div ext:qtip="{state}. {nick}" class="x-combo-list-item">{state}</div></tpl>',
51 emptyText:'Select a state...',
53 applyTo: 'local-states-with-qtip'
56 var converted = new Ext.form.ComboBox({
64 // Create code view Panels. Ignore.
66 contentEl: 'state-combo-code',
67 width: Ext.getBody().child('p').getWidth(),
68 title: 'View code to create this combo',
69 hideCollapseTool: true,
73 renderTo: 'state-combo-code-panel'
76 contentEl: 'state-combo-qtip-code',
78 width: Ext.getBody().child('p').getWidth(),
79 title: 'View code to create this combo',
80 hideCollapseTool: true,
84 renderTo: 'state-combo-qtip-code-panel'
87 contentEl: 'array-combo-code',
89 width: Ext.getBody().child('p').getWidth(),
90 title: 'View code to create this combo',
91 hideCollapseTool: true,
95 renderTo: 'array-combo-code-panel'
98 contentEl: 'transformed-combo-code',
100 width: Ext.getBody().child('p').getWidth(),
101 title: 'View code to create this combo',
102 hideCollapseTool: true,
106 renderTo: 'transformed-combo-code-panel'