EXTJS4 Common Configuration Method Memo

Source: Internet
Author: User

viewport layout Common Properties

            NewExt.viewport ({layout:"Border", RenderTo:Ext.getBody (), defaults: {bodystyle:"Background-color: #FFFFFF;", Frame:true                },                //Split is true to get up and down to the left and right stretching effect                //Layout:fit, filling the layout                //Collapsible:true,north module is shrunk to the topItems: [{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 extrude Properties, and Textareafield,form properties

Reminder: resizable:true,//can be stretched, but also applicable to Textareafield,form, etc.

 varAdddialog = Ext.create ("Ext.window.Window", {layout:"Fit", Iconcls:' A_add ', Closeaction:' Hide ',//window closed by: Hide/closeResizable:true,//Whether you can stretchClosable:true,//Whether you can closeModaltrue,//whether the modal windowitems:addform, buttons: [{text:Add, Iconcls:' A_add ', ID:"Btnadd", Handler:add}, {ID:"Btncancel", Iconcls:' A_cross ', Text:' Reset ', Handler:function() {AddForm.form.reset (); }                }]            });
null default value, validation configuration, and validation method, column layout

 varAddForm = Ext.create ("Ext.form.Panel", {border:false, Fielddefaults: {msgtarget:' Side ',//prompt message displays icon next to rightLabelwidth:70, align:"Right", Allowblank:false //No and Xu is empty}, Width:380, defaults: {padding:10,}, layout:' Column ', items: [{xtype:"Hidden", Name:' Quid ',}, {xtype:"Numberfield", Fieldlabel:' First question ', Name:' Sorts ', regex:/^\d+$/,//Regular Validationmaxlength:100, ColumnWidth:1,}, {xtype:"Combo", Fieldlabel:' Skin classification ', Name:' Claid ', ID:' Claid ', Valuefield:' Qcid ', Displayfield:' Claname ', ColumnWidth:1,//the proportion of the column layout station, a total of 1, more divided into 0.5+0.5 .... and for 1Allowblank:false, Store:questionclassstore, Emptytext:"Please select a skin category",//dark gray hint for empty input boxBlanktext: "Please select skin category 111",//Error Hints}, {xtype:"Filefield", Fieldlabel:' Upload image ', ButtonText:Browse, regex:/^.+\. ((jpg) | (GIF) | (GIF) | (PNG) | (JPEG) | (BMP)) $/,//Regular ValidationName: ' Queimg ', Allowblank:true,//not allowed to be emptyColumnwidth:1}, {xtype:"Textareafield", Grow:true, Fieldlabel:Problem, Name:' Question ', ColumnWidth:1                     }                ]            }); //Add a question            functionAdd () {varform = Addform.getform ();//Get form form                if(Form.isvalid ()) {//Validating Formsform.submit ({URL:"/question/add", params: {Json:Ext.JSON.encode (AddForm.form.getValues ())}, Waitmsg: ' Uploading Please wait ... ', Success:function(form, action) {Ext.Msg.alert (Prompted, action.result.msg);                        Questiongridstore.load (); },                    })                }            }
the path to the IMG src assignment value
               function () {                        var rows = shoppapergrid.getview (). Getselectionmodel (). GetSelection ();                         if (typeof (rows[0])! = "undefined") {                            ext.getcmp ("Imgform"). Getel (). DOM.SRC = Rows[0]. Data.imgpath;   Assigns a value to                        src                        }else  {                            ext.getcmp ("Imgform"). Getel (). dom.src = "/images/ Default.jpg ";                        }                    }
Ext.msg.confrim ()

   function (BTN) {                //btn=yes or no                if (btn = = "Yes") {                    alert ("Delete succeeded" );                }                 Else {                    alert ("Cancel Delete");}            );
first write so much, now can't remember, think up Plus, as a memo blog

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.