4b7c05c63306c1ac23564e3bfa793525d366ed48
[roojs1] / examples / form / combocheck.js
1 /*
2  * 
3  * (C) Alan Knowles 2011
4  * Licence : Roojs - LGPL
5  */
6  
7 var mform;
8 var combo
9 Roo.onReady(function(){
10
11     Roo.QuickTips.init();
12
13  
14     /*
15      * ================  Form 2  =======================
16      */
17     mform = Roo.factory({
18         xns : Roo.form,
19         xtype : 'Form',
20         labelAlign: 'top',
21         items : [
22             {
23                 xtype : 'ComboCheck',
24                 xns: Roo.form,
25                 
26                 fieldLabel: 'State',
27                 
28                 name : 'states_list',
29                 hiddenName:'states',
30                 
31                 
32                 valueField : 'abbr',
33                 displayField:'state',
34                 
35              
36                 store: {
37                     xns : Roo.data,
38                     xtype : 'SimpleStore',
39                     fields: ['abbr', 'state'],
40                     data : Roo.exampledata.states // from states.js
41                    
42                 },
43                 
44                 typeAhead: true,
45                 mode: 'local',
46                 triggerAction: 'all',
47                 emptyText:'Select a state...',
48                 selectOnFocus:true,
49                 width:190,
50                 listeners : {
51                     change: function() {
52                         Roo.log("changed to " + this.getValue());
53                         
54                     }
55                 }
56           }
57
58             
59         ]
60         
61     });
62
63     mform.render('form-ct5');
64     combo = mform.findField('states');
65     mform.setValues({
66         states : '["AK","AZ"]',
67         states_list : "Alaska, Arizona"
68         
69     })
70     
71     
72 });