statusbar-advanced.js
上传用户:dawnssy
上传日期:2022-08-06
资源大小:9345k
文件大小:2k
源码类别:

JavaScript

开发平台:

JavaScript

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