EXTJS2.2 FormPane對象研究

來源:互聯網
上載者:User

function cForm()
{

    ///------------------------資料來源
        var arr=[ [1, '本.拉登'], [2, '笨.拉登'],[3, '笨.拉燈'],[6, '笨.1'],[7, '笨.2'],[8, '笨.3'],[4,'無敵了'],[5,'無人了'] ];
        var reader = new Ext.data.ArrayReader(
       {id: 0},
       [
        {name: 'value'},       
        {name: 'key'}  
        ]);
        var store=new Ext.data.Store({
          reader:reader
       });
       store.loadData(arr);
    //--------------------------
    //測試面板
        var xform = new Ext.form.FormPanel({
        ///applyTo:"MXT",
        ///基本樣式
        baseCls: 'x-plain',
        ///布局凡是
        layout:'absolute',
        ///提交的資料
url:'save-form.php',
        //閉合時的效果
        animCollapse:true,
        ///預設的 輸入類型
        defaultType: 'textfield',
        items: [{
            x: 0,
            y: 5,
            xtype:'label',
            text: '測試中...:'
        },{
         ///是否允許為空白
           allowBlank: false,
         //驗證的提示文字內容
            blankText:'驗證的提示內容,不可為空',
            x: 60,
            y: 0,
            name: 'to',
            fieldLabel:'text',
            maskRe:/[a-zA-z]/gi,
            anchor:'50%'  // anchor width by percentage
        },
        ///CLASS
        {
            x: 300,
            y: 0,
            name: 'tozcxv',
            anchor:'100%'  // anchor width by percentage
        },
        {
            x: 0,
            y: 35,
            xtype:'label',
            text: '測試中:'
        },{
            x: 60,
            y: 30,
            //maskRe:'/[a-zA-z]/gi',
            name: '開始中',
            anchor: '100%'  // anchor width by percentage
        },{
            x:0,
            y: 60,
            xtype: 'textarea',
            name: 'msg',
            anchor: '100% 40%'  // anchor width and height
        },
        ///時間按鈕
        {
            x:0,
            y:200,
            xtype: 'datefield',
            name: 'msgzcx',
            anchor: '50% 100%'  // anchor width and height
        },
//           ///時間
        {
            x:240,
            y:200,
            xtype: 'timefield',
            name: 'msgzcxdt',
            ///時間的遞增
            increment:10,
            ///驗證失敗的文字提示
            invalidText:'時間格式不正確',
            anchor: '50% 100%'  // anchor width and height
        },
        ///下拉選項框
            {
                x:0,
                y:230,
                xtype: 'combo',
                ///定義具體的類型 select  ComboBox
                fieldLabel:'ComboBox',
                ///是否可編輯 true ComboBox false select
                editable:true,
                //至少幾個字時開始檢索並顯示檢索結果 注意衝突
                minChars:2,
                ///每頁顯示的大小
                pageSize:3,
                ///值不存在時的顯示
                valueNotFoundText:'無此選項',
                ///顯示的欄位
                displayField:'key',
                ///資料類型類型 本地
                mode: 'local',
                ///資料來源
                store:store
            },
            {
            x:0,
            y: 260,
            xtype: 'numberfield',
            name: 'msgzcx',
            anchor: '100% 100%'  // anchor width and height
        },
        //數字
        {
            x:0,
            y: 300,
            xtype: 'numberfield',
            name: 'msgzcx',
            anchor: '100% 100%'  // anchor width and height
        }
        ],
        buttons: [{
     text: '登陸',
     type: 'submit',
     //定義表單提交事件
     handler:function(){
     ///提交表單
            xform.getForm().submit({
url:'Operator.aspx?Action=1SAVE',
                               method:'post',
                               success:function(form,action){
           alert('adsf');
          },
          //提交失敗的回呼函數
          failure:function(){
           alert('失敗');
          }
                                 });
                                 //提交成功的回呼函數
           //alert(xform.getForm());
     }
     }]
    });
     var window = new Ext.Window({
        ///標題
        title: '操作人員管理',
        ///寬
        width: 500,
        ///高
        height:500,
        ///最小的寬頻
        minWidth: 300,
        ///最小的高度
        minHeight: 200,
        ///布局的方式
        layout: 'fit',
        ///是否允許調整大小
        resizable:false,
        ///是否准許拖動
        draggable:true,
        ///關閉按鈕
        closable:true,
        ///是否視圖中顯示
        constrain:true,
        ///是否為透明背景
        plain:true,
        ///顯示最小化按鈕
        minimizable:true,
        ///最大化按鈕
        maximizable:true,
        ///是否顯示收縮按鈕
        expandOnShow:true,
        ///是否顯示關閉按鈕
        closable:false,
        ///關閉按鈕樣式
        collapsedCls:"x-plain",
         ///不可用時  是否進行遮擋
        maskDisabled:true,
        ///頭部文本
        headerAsText:"頭部標題",
        ///表
        bodyStyle:'padding:5px;',
        ///按鈕的對其方式
        buttonAlign:'center',
         items: xform,

        buttons: [{
            text: '關閉'
        },{
            text: '取消'
        }]
    });

    window.show();

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.