Part of the materials are from: Intense Javascript development-ext detailed practices
1 // <Reference Path = "vswd-ext_2.0.2.js">
2 Ext. onready (function (){
3 var cities = [['beijing ',
4 [
5 ['beijing'],
6 ['tongxian '],
7 ['changping '],
8 ['daxing '],
9 ['miyun '],
10 ['shunyi '],
11 ['platform']
12],
13 ['guangdong ',
14 [
15 ['chaozhou '],
16 ['shantou ']
17]
18]
19];
20
21 var localprovince = new Ext. Data. simplestore ({
22 fields: ['cmds', 'Cities '],
23 data: Cities
24 });
25
26 var localcities = new Ext. Data. simplestore ({
27 fields: ['cities '],
28 data: []
29 });
30
31 var FRM = new Ext. Form. formpanel ({
32 title: 'combo ',
33 width: 300,
34 autoheight: True,
35 applyto: 'Con ',
36 frame: True,
37 labelwidth: 50,
38 labelalign: 'right ',
39 items :[
40 {
41 xtype: 'combo ',
42 triggeraction: 'all ',
43 anchor: '123 ',
44 fieldlabel: 'cmds ',
45 Editable: false,
46 mode: 'local ',
47 store: localprovince,
48 displayfield: 'cmds ',
49 name: 'cmds ',
50 listeners :{
51 select: function (Form, REC, index ){
52 frm. getform (). findfield ('cities '). clearvalue ();
53 localcities. loaddata (Rec. Get ('cities '));
54}
55}
56 },{
57 xtype: 'combo ',
58 triggeraction: 'all ',
59 anchor: '123 ',
60 fieldlabel: 'cities ',
61 Editable: false,
62 name: 'cities ',
63 mode: 'local ',
64 displayfield: 'cities ',
65 store: localcities
66}
67]
68 });
69 });