source: trunk/web/addons/job_monarch/lib/extjs/examples/statusbar/statusbar-advanced.js @ 619

Last change on this file since 619 was 619, checked in by ramonb, 15 years ago

lib/:

  • added new AJAX dependancies: ExtJS, pChart, Lightbox2
File size: 2.0 KB
Line 
1/*
2 * Ext JS Library 2.2.1
3 * Copyright(c) 2006-2009, Ext JS, LLC.
4 * licensing@extjs.com
5 *
6 * http://extjs.com/license
7 */
8
9
10Ext.QuickTips.init();
11
12Ext.onReady(function(){
13
14    var fp = new Ext.FormPanel({
15        id: 'status-form',
16        renderTo: Ext.getBody(),
17        labelWidth: 75,
18        width: 350,
19        buttonAlign: 'right',
20        border: false,
21        bodyStyle: 'padding:10px 10px 0;',
22        defaults: {
23            anchor: '95%',
24            allowBlank: false,
25            selectOnFocus: true,
26            msgTarget: 'side'
27        },
28        items:[{
29            xtype: 'textfield',
30            fieldLabel: 'Name',
31            blankText: 'Name is required'
32        },{
33            xtype: 'datefield',
34            fieldLabel: 'Birthdate',
35            blankText: 'Birthdate is required'
36        }],
37        buttons: [{
38            text: 'Save',
39            handler: function(){
40                if(fp.getForm().isValid()){
41                    var sb = Ext.getCmp('form-statusbar');
42                    sb.showBusy('Saving form...');
43                    fp.getEl().mask();
44                    fp.getForm().submit({
45                        url: 'fake.php',
46                        success: function(){
47                            sb.setStatus({
48                                text:'Form saved!', 
49                                iconCls:'',
50                                clear: true
51                            });
52                            fp.getEl().unmask();
53                        }
54                    });
55                }
56            }
57        }]
58    });
59   
60    new Ext.Panel({
61        title: 'StatusBar with Integrated Form Validation',
62        renderTo: Ext.getBody(),
63        width: 350,
64        autoHeight: true,
65        layout: 'fit',
66        items: fp,
67        bbar: new Ext.StatusBar({
68            id: 'form-statusbar',
69            defaultText: 'Ready',
70            plugins: new Ext.ux.ValidationStatus({form:'status-form'})
71        })
72    });
73   
74});
Note: See TracBrowser for help on using the repository browser.