PageRenderTime 32ms CodeModel.GetById 18ms app.highlight 13ms RepoModel.GetById 0ms app.codeStats 0ms

/ext-4.0.7/examples/statusbar/statusbar-advanced.js

https://bitbucket.org/srogerf/javascript
JavaScript | 89 lines | 71 code | 4 blank | 14 comment | 1 complexity | a4a9d1375717e11e6c1db5a2ddc85306 MD5 | raw file
 1/*
 2
 3This file is part of Ext JS 4
 4
 5Copyright (c) 2011 Sencha Inc
 6
 7Contact:  http://www.sencha.com/contact
 8
 9GNU General Public License Usage
10This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file.  Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
11
12If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
13
14*/
15Ext.Loader.setConfig({
16    enabled: true
17});
18
19Ext.Loader.setPath('Ext.ux', '../ux/');
20
21Ext.require([
22  'Ext.form.Panel',
23  'Ext.form.field.Date',
24  'Ext.tip.QuickTipManager',
25  'Ext.ux.statusbar.StatusBar',
26  'Ext.ux.statusbar.ValidationStatus'
27]);
28
29
30Ext.onReady(function(){
31    Ext.tip.QuickTipManager.init();
32    var fp = Ext.create('Ext.FormPanel', {
33        title: 'StatusBar with Integrated Form Validation',
34        renderTo: Ext.getBody(),
35        width: 350,
36        autoHeight: true,
37        id: 'status-form',
38        renderTo: Ext.getBody(),
39        labelWidth: 75,
40        bodyPadding: 10,
41        defaults: {
42            anchor: '95%',
43            allowBlank: false,
44            selectOnFocus: true,
45            msgTarget: 'side'
46        },
47        items:[{
48            xtype: 'textfield',
49            fieldLabel: 'Name',
50            blankText: 'Name is required'
51        },{
52            xtype: 'datefield',
53            fieldLabel: 'Birthdate',
54            blankText: 'Birthdate is required'
55        }],
56        dockedItems: [{
57            xtype: 'toolbar',
58            dock: 'bottom',
59            ui: 'footer',
60            items: ['->', {
61                text: 'Save',
62                handler: function(){
63                    if(fp.getForm().isValid()){
64                        var sb = Ext.getCmp('form-statusbar');
65                        sb.showBusy('Saving form...');
66                        fp.getEl().mask();
67                        fp.getForm().submit({
68                            url: 'fake.php',
69                            success: function(){
70                                sb.setStatus({
71                                    text:'Form saved!',
72                                    iconCls:'',
73                                    clear: true
74                                });
75                                fp.getEl().unmask();
76                            }
77                        });
78                    }
79                }
80            }]
81        }, 
82            Ext.create('Ext.ux.StatusBar', {
83                dock: 'bottom',
84                id: 'form-statusbar',
85                defaultText: 'Ready',
86                plugins: Ext.create('Ext.ux.statusbar.ValidationStatus', {form:'status-form'})
87            })]
88    });
89});