statusbar-advanced.js
2.2 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
Ext.Loader.setConfig({
enabled: true
});
Ext.Loader.setPath('Ext.ux', '../ux/');
Ext.require([
'Ext.form.Panel',
'Ext.form.field.Date',
'Ext.tip.QuickTipManager',
'Ext.ux.statusbar.StatusBar',
'Ext.ux.statusbar.ValidationStatus'
]);
Ext.onReady(function(){
Ext.tip.QuickTipManager.init();
var fp = Ext.create('Ext.FormPanel', {
title: 'StatusBar with Integrated Form Validation',
renderTo: Ext.getBody(),
width: 350,
autoHeight: true,
id: 'status-form',
renderTo: Ext.getBody(),
labelWidth: 75,
bodyPadding: 10,
defaults: {
anchor: '95%',
allowBlank: false,
selectOnFocus: true,
msgTarget: 'side'
},
items:[{
xtype: 'textfield',
fieldLabel: 'Name',
blankText: 'Name is required'
},{
xtype: 'datefield',
fieldLabel: 'Birthdate',
blankText: 'Birthdate is required'
}],
dockedItems: [{
xtype: 'toolbar',
dock: 'bottom',
ui: 'footer',
items: ['->', {
text: 'Save',
handler: function(){
if(fp.getForm().isValid()){
var sb = Ext.getCmp('form-statusbar');
sb.showBusy('Saving form...');
fp.getEl().mask();
fp.getForm().submit({
url: 'fake.php',
success: function(){
sb.setStatus({
text:'Form saved!',
iconCls:'',
clear: true
});
fp.getEl().unmask();
}
});
}
}
}]
},
Ext.create('Ext.ux.StatusBar', {
dock: 'bottom',
id: 'form-statusbar',
defaultText: 'Ready',
plugins: Ext.create('Ext.ux.statusbar.ValidationStatus', {form:'status-form'})
})]
});
});