Fix #6201 - Category select
[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     var sampleData = 
15  
16  
17  
18     /*
19      * ================  Form 2  =======================
20      */
21     mform = Roo.factory({
22         xns : Roo.form,
23         xtype : 'Form',
24         labelAlign: 'top',
25         items : [
26             {
27                 xtype : 'ComboCheck',
28                 xns: Roo.form,
29                 
30                 fieldLabel: 'State',
31                 
32                 name : 'states_list',
33                 hiddenName:'states',
34                 
35                 
36                 valueField : 'abbr',
37                 displayField:'state',
38                 
39              
40                 store: {
41                     xns : Roo.data,
42                     xtype : 'SimpleStore',
43                     fields: ['abbr', 'state'],
44                     data : Roo.exampledata.states // from states.js
45                    
46                 },
47                 
48                 typeAhead: true,
49                 mode: 'local',
50                 triggerAction: 'all',
51                 emptyText:'Select a state...',
52                 selectOnFocus:true,
53                 width:190,
54                 listeners : {
55                     change: function() {
56                         Roo.log("changed to " + this.getValue());
57                         
58                     }
59                 }
60           }
61
62             
63         ]
64         
65     });
66
67     mform.render('form-ct5');
68     combo = mform.findField('states');
69     mform.setValues({
70         states : '["AK","AZ"]',
71         states_list : "Alaska, Arizona"
72         
73     })
74     
75     
76 });