source: trunk/web/addons/job_monarch/lib/extjs/examples/form/combos.js @ 619

Last change on this file since 619 was 619, checked in by ramonb, 15 years ago

lib/:

  • added new AJAX dependancies: ExtJS, pChart, Lightbox2
File size: 3.4 KB
Line 
1/*
2 * Ext JS Library 2.2.1
3 * Copyright(c) 2006-2009, Ext JS, LLC.
4 * licensing@extjs.com
5 *
6 * http://extjs.com/license
7 */
8
9Ext.onReady(function(){
10    Ext.QuickTips.init();
11
12    // simple array store
13    var store = new Ext.data.SimpleStore({
14        fields: ['abbr', 'state', 'nick'],
15        data : Ext.exampledata.states // from states.js
16    });
17    var combo = new Ext.form.ComboBox({
18        store: store,
19        displayField:'state',
20        typeAhead: true,
21        mode: 'local',
22        forceSelection: true,
23        triggerAction: 'all',
24        emptyText:'Select a state...',
25        selectOnFocus:true,
26        applyTo: 'local-states'
27    });
28   
29    //Simple arrays can be used directly as the store config.  1-dimensional arrays
30    //will automatically be expanded (each array item will be the combo value and text)
31    //and for multi-dimensional arrays, the value in index 0 of each item will be assumed
32    //to be the value, while the value at index 1 is assumed to be the text.  For example,
33    //[['AL', 'Alabama'],['AK', 'Alaska'], etc.]. Any other values beyond index 1 within
34    //each item will be ignored using this approach.
35        var comboFromArray = new Ext.form.ComboBox({
36            store: Ext.exampledata.states,
37            typeAhead: true,
38        forceSelection: true,
39            triggerAction: 'all',
40            emptyText:'Select a state...',
41            selectOnFocus:true,
42            applyTo: 'array-states'
43        });
44
45    var comboWithTooltip = new Ext.form.ComboBox({
46        tpl: '<tpl for="."><div ext:qtip="{state}. {nick}" class="x-combo-list-item">{state}</div></tpl>',
47        store: store,
48        displayField:'state',
49        typeAhead: true,
50        forceSelection: true,
51        mode: 'local',
52        triggerAction: 'all',
53        emptyText:'Select a state...',
54        selectOnFocus:true,
55        applyTo: 'local-states-with-qtip'
56    });
57
58    var converted = new Ext.form.ComboBox({
59        typeAhead: true,
60        triggerAction: 'all',
61        transform:'state',
62        width:135,
63        forceSelection:true
64    });
65   
66//  Create code view Panels. Ignore.
67    new Ext.Panel({
68        contentEl: 'state-combo-code',
69        width: Ext.getBody().child('p').getWidth(),
70        title: 'View code to create this combo',
71        hideCollapseTool: true,
72        titleCollapse: true,
73        collapsible: true,
74        collapsed: true,
75        renderTo: 'state-combo-code-panel'
76    });
77    new Ext.Panel({
78        contentEl: 'state-combo-qtip-code',
79        autoScroll: true,
80        width: Ext.getBody().child('p').getWidth(),
81        title: 'View code to create this combo',
82        hideCollapseTool: true,
83        titleCollapse: true,
84        collapsible: true,
85        collapsed: true,
86        renderTo: 'state-combo-qtip-code-panel'
87    });
88    new Ext.Panel({
89        contentEl: 'array-combo-code',
90        autoScroll: true,
91        width: Ext.getBody().child('p').getWidth(),
92        title: 'View code to create this combo',
93        hideCollapseTool: true,
94        titleCollapse: true,
95        collapsible: true,
96        collapsed: true,
97        renderTo: 'array-combo-code-panel'
98    });
99    new Ext.Panel({
100        contentEl: 'transformed-combo-code',
101        autoScroll: true,
102        width: Ext.getBody().child('p').getWidth(),
103        title: 'View code to create this combo',
104        hideCollapseTool: true,
105        titleCollapse: true,
106        collapsible: true,
107        collapsed: true,
108        renderTo: 'transformed-combo-code-panel'
109    });
110
111});
Note: See TracBrowser for help on using the repository browser.