ExtJs4常用配置方法備忘

來源:互聯網
上載者:User

標籤:style   blog   http   color   os   io   for   ar   

viewport布局常用屬性

 

            new Ext.Viewport({                layout: "border",                renderTo: Ext.getBody(),                defaults: {                    bodyStyle: "background-color: #FFFFFF;",                    frame: true                },                //split為true,即可達到上下左右展開效果                //layout:fit,填滿布局                //collapsible:true,north模組被收縮到最上面                items: [{ region: "north", height: "60%", collapsible: true, split: true, layout: "fit", border: true, items: [ClassTreeGrid] },                        { region: "center", autoScroll: true, split: true, border: true, layout: "fit", items: [RecGrid] }                ]            });
Ext.window.Window展開屬性,以及textareafield,form的可展開屬性

提醒:resizable: true, //是否可以展開,同時也適用於textareafield,form等

 var AddDialog = Ext.create("Ext.window.Window", {                layout: "fit",                iconCls: ‘a_add‘,                closeAction: ‘hide‘,        //視窗關閉的方式:hide/close                resizable: true,            //是否可以展開                closable: true,            //是否可以關閉                modal: true,                //是否為模態視窗                items: AddForm,                buttons: [{                    text: ‘添加‘,                    iconCls: ‘a_add‘,                    id: "btnAdd",                    handler: Add                },                {                    id: "btnCancel",                    iconCls: ‘a_cross‘,                    text: ‘重設‘,                    handler: function () {                        AddForm.form.reset();                    }                }]            });
為空白預設值,驗證配置,及驗證方法,column布局

 var AddForm = Ext.create("Ext.form.Panel", {                border: false,                fieldDefaults: {                    msgTarget: ‘side‘,  //提示資訊在右旁邊顯示表徵圖                    labelWidth: 70,                    align: "right",                    allowBlank: false //不與許為空白                },                width: 380,                defaults: {                    padding: 10,                },                layout: ‘column‘,                items: [                     {                         xtype: "hidden",                         name: ‘quId‘,                     },                      {                          xtype: "numberfield",                          fieldLabel: ‘第幾題‘,                          name: ‘sorts‘,                          regex: /^\d+$/,  //正則驗證                          maxLength: 100,                          columnWidth: 1,                      },                    {                        xtype: "combo",                        fieldLabel: ‘皮膚分類‘,                        name: ‘claId‘,                        id: ‘claId‘,                        valueField: ‘qcId‘,                        displayField: ‘claName‘,                        columnWidth: 1,   //列布局站的比例,總共為1,多分為0.5+0.5 ....和為1                         allowBlank: false,                        store: QuestionClassStore,                        emptyText: "請選擇皮膚分類", //為空白輸入框暗灰提示                        blankText: "請選擇皮膚分類111", //錯誤提示                    },                     {                         xtype: "filefield",                         fieldLabel: ‘上傳圖片‘,                         buttonText: ‘  瀏 覽  ‘,                         regex: /^.+\.((jpg)|(gif)|(gif)|(png)|(jpeg)|(bmp))$/, //正則驗證                         name: ‘queImg‘,                         allowBlank: true, //不允許為空白                         columnWidth: 1                     },                     {                         xtype: "textareafield",                         grow: true,                         fieldLabel: ‘問題‘,                         name: ‘question‘,                         columnWidth: 1                     }                ]            });            //添加問題            function Add() {                var form = AddForm.getForm();  //擷取表單form                if (form.isValid()) {   //驗證表單                    form.submit({                        url: "/question/Add",                        params: { json: Ext.JSON.encode(AddForm.form.getValues()) },                        waitMsg: ‘正在上傳請稍候...‘,                        success: function (form, action) {                            Ext.Msg.alert("提示", action.result.msg);                            QuestionGridStore.load();                        },                    })                }            }
給img的路徑src賦值
               itemclick: function () {                        var rows = ShopPaperGrid.getView().getSelectionModel().getSelection();                        if (typeof (rows[0]) != "undefined") {                            Ext.getCmp("imgForm").getEl().dom.src = rows[0].data.imgPath;   //給src賦值                        }                        else {                            Ext.getCmp("imgForm").getEl().dom.src = "/images/default.jpg";                        }                    }
ext.msg.confrim()

   Ext.Msg.confirm("提示", "確定刪除", function (btn) {                //btn=yes或者no                if (btn == "yes") {                    alert("刪除成功");                }                else {                    alert("取消啦刪除");                }            });
先寫這麼多,現在想不起來啦,想起來再加上,做為備忘部落格 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.