vbox-form.js
2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
Ext.Loader.setConfig({enabled: true});
Ext.Loader.setPath('Ext.ux', '../ux/');
Ext.require([
'Ext.form.*',
'Ext.window.Window',
'Ext.data.*',
'Ext.ux.FieldReplicator'
]);
Ext.onReady(function() {
var form = Ext.create('Ext.form.Panel', {
plain: true,
border: 0,
bodyPadding: 5,
url: 'save-form.php',
fieldDefaults: {
labelWidth: 55,
anchor: '100%'
},
layout: {
type: 'vbox',
align: 'stretch' // Child items are stretched to full width
},
items: [{
xtype: 'combo',
store: Ext.create('Ext.data.ArrayStore', {
fields: [ 'email' ],
data: [
['test@example.com'],
['someone@example.com'],
['someone-else@example.com']
]
}),
displayField: 'email',
plugins: [ Ext.ux.FieldReplicator ],
fieldLabel: 'Send To',
queryMode: 'local',
selectOnTab: false,
name: 'to',
onReplicate: function(){
this.getStore().clearFilter();
}
}, {
xtype: 'textfield',
fieldLabel: 'Subject',
name: 'subject'
}, {
xtype: 'textarea',
fieldLabel: 'Message text',
hideLabel: true,
name: 'msg',
style: 'margin:0', // Remove default margin
flex: 1 // Take up all *remaining* vertical space
}]
});
var win = Ext.create('Ext.window.Window', {
title: 'Compose message',
collapsible: true,
animCollapse: true,
maximizable: true,
width: 750,
height: 500,
minWidth: 300,
minHeight: 200,
layout: 'fit',
items: form,
dockedItems: [{
xtype: 'toolbar',
dock: 'bottom',
ui: 'footer',
layout: {
pack: 'center'
},
items: [{
minWidth: 80,
text: 'Send'
},{
minWidth: 80,
text: 'Cancel'
}]
}]
});
win.show();
});