3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js">Ext.onReady(function(){
12 var store = new Ext.data.ArrayStore({
13 fields: ['abbr', 'state', 'nick'],
14 data : Ext.exampledata.states // from states.js
16 var combo = new Ext.form.ComboBox({
23 emptyText:'Select a state...',
25 applyTo: 'local-states'
28 //Simple arrays can be used directly as the store config. 1-dimensional arrays
29 //will automatically be expanded (each array item will be the combo value and text)
30 //and for multi-dimensional arrays, the value in index 0 of each item will be assumed
31 //to be the value, while the value at index 1 is assumed to be the text. For example,
32 //[['AL', 'Alabama'],['AK', 'Alaska'], etc.]. Any other values beyond index 1 within
33 //each item will be ignored using this approach.
34 var comboFromArray = new Ext.form.ComboBox({
35 store: Ext.exampledata.states,
39 emptyText:'Select a state...',
41 applyTo: 'array-states'
44 var comboWithTooltip = new Ext.form.ComboBox({
45 tpl: '<tpl for="."><div ext:qtip="{state}. {nick}" class="x-combo-list-item">{state}</div></tpl>',
52 emptyText:'Select a state...',
54 applyTo: 'local-states-with-qtip'
57 var converted = new Ext.form.ComboBox({
65 // Create code view Panels. Ignore.
67 contentEl: 'state-combo-code',
68 width: Ext.getBody().child('p').getWidth(),
69 title: 'View code to create this combo',
70 hideCollapseTool: true,
74 renderTo: 'state-combo-code-panel'
77 contentEl: 'state-combo-qtip-code',
79 width: Ext.getBody().child('p').getWidth(),
80 title: 'View code to create this combo',
81 hideCollapseTool: true,
85 renderTo: 'state-combo-qtip-code-panel'
88 contentEl: 'array-combo-code',
90 width: Ext.getBody().child('p').getWidth(),
91 title: 'View code to create this combo',
92 hideCollapseTool: true,
96 renderTo: 'array-combo-code-panel'
99 contentEl: 'transformed-combo-code',
101 width: Ext.getBody().child('p').getWidth(),
102 title: 'View code to create this combo',
103 hideCollapseTool: true,
107 renderTo: 'transformed-combo-code-panel'