Extjs中布局的组合使用.docx_第1页
Extjs中布局的组合使用.docx_第2页
Extjs中布局的组合使用.docx_第3页
Extjs中布局的组合使用.docx_第4页
Extjs中布局的组合使用.docx_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Extjs4.1中布局的组合使用Extjs4.1中布局很经典,也很好用,关键是如何组合布局,组合布局,不仅要达到我们想要的界面效果,还要注意因为布局所付出的渲染代价。下面是我经过反复调试,总结的最常用也很高效的几种组合布局,废话不多说,先看其中一个效果图:因为Extjs布局本身并没有难度,我也没必要在这浪费口舌说些没用的知识点,下面是详细代码,复制粘贴就可以直接运行(注意引入extjs的包).相信效果会吓你一跳。HTML代码:无标题文档$(document).ready(function()Ext.onReady(function()Ext.require( /Ext.form.*, /Ext.layout.container.Column, /Ext.tab.Panel *);Ext.onReady(function() Ext.QuickTips.init(); var bd = Ext.getBody(); /* * = Simple form = */ bd.createChild(tag: h2, html: Form 1 - Very Simple); var required = *; var simple = Ext.widget(form, layout: form, collapsible: true, id: simpleForm, url: save-form.php, frame: true, title: Simple Form, bodyPadding: 5 5 0, width: 350, fieldDefaults: msgTarget: side, labelWidth: 75 , defaultType: textfield, items: fieldLabel: First Name, afterLabelTextTpl: required, name: first, allowBlank: false , fieldLabel: Last Name, afterLabelTextTpl: required, name: last, allowBlank: false , fieldLabel: Company, name: company , fieldLabel: Email, afterLabelTextTpl: required, name: email, allowBlank: false, vtype:email , fieldLabel: DOB, name: dob, xtype: datefield , fieldLabel: Age, name: age, xtype: numberfield, minValue: 0, maxValue: 100 , xtype: timefield, fieldLabel: Time, name: time, minValue: 8:00am, maxValue: 6:00pm , buttons: text: Save, handler: function() this.up(form).getForm().isValid(); , text: Cancel, handler: function() this.up(form).getForm().reset(); ); simple.render(document.body); /* * = Form 2 = */ bd.createChild(tag: h2, html: Form 2 - Adding fieldsets); var fsf = Ext.widget( xtype: form, id: fieldSetForm, collapsible: true, url: save-form.php, frame: true, title: Simple Form with FieldSets, bodyPadding: 5 5 0,layout: anchor, width: 350, fieldDefaults: msgTarget: side, labelWidth: 75 , defaults: anchor: 100% , items: xtype:fieldset, checkboxToggle:true, title: User Information, defaultType: textfield, collapsed: true, layout: anchor, defaults: anchor: 100% , items : fieldLabel: First Name, afterLabelTextTpl: required, name: first, allowBlank:false , fieldLabel: Last Name, afterLabelTextTpl: required, name: last , fieldLabel: Company, name: company , fieldLabel: Email, afterLabelTextTpl: required, name: email, vtype:email , xtype:fieldset, title: Phone Number, collapsible: true, defaultType: textfield, layout: anchor, defaults: anchor: 100% , items : fieldLabel: Home, name: home, value: (888) 555-1212 , fieldLabel: Business, name: business , fieldLabel: Mobile, name: mobile , fieldLabel: Fax, name: fax , buttons: text: Save , text: Cancel ); fsf.render(document.body); /* * = Form 3 = */ bd.createChild(tag: h2, html: Form 3 - A little more complex); var top = Ext.widget( xtype: form, id: multiColumnForm, collapsible: true, frame: true, title: Multi Column, Nested Layouts and Anchoring, bodyPadding: 5 5 0, width: 600, fieldDefaults: labelAlign: top, msgTarget: side , items: xtype: container, anchor: 100%, layout: hbox, items: xtype: container, flex: 1, layout: anchor, items: xtype:textfield, fieldLabel: First Name, afterLabelTextTpl: required, allowBlank: false, name: first, anchor:95%, value: Don , xtype:textfield, fieldLabel: Company, name: company, anchor:95% , xtype: container, flex: 1, layout: anchor, items: xtype:textfield, fieldLabel: Last Name, afterLabelTextTpl: required, allowBlank: false, name: last, anchor:100%, value: Griffin , xtype:textfield, fieldLabel: Email, afterLabelTextTpl: required, allowBlank: false, name: email, vtype:email, anchor:100% , xtype: htmleditor, name: bio, fieldLabel: Biography, height: 200, anchor: 100% , buttons: text: Save, handler: function() this.up(form).getForm().isValid(); , text: Cancel, handler: function() this.up(form).getForm().reset(); ); top.render(document.body); /* * = Form 4 = */ bd.createChild(tag: h2, html: Form 4 - Forms can be a TabPanel.); var tabs = Ext.widget( xtype: form, id: tabForm, width: 350, border: false, bodyBorder: false, fieldDefaults: labelWidth: 75, msgTarget: side , items: xtype:tabpanel, activeTab: 0, defaults: bodyPadding: 10, layout: anchor , items: title:Personal Details, defaultType: textfield, defaults: anchor: 100% , items: fieldLabel: First Name, name: first, afterLabelTextTpl: required, allowBlank: false, value: Ed , fieldLabel: Last Name, afterLabelTextTpl: required, allowBlank: false, name: last, value: Spencer , fieldLabel: Company, name: company, value: Ext JS , fieldLabel: Email, afterLabelTextTpl: required, allowBlank: false, name: email, vtype:email , title: Phone Numbers, defaultType: textfield, defaults: anchor: 100% , items: fieldLabel: Home, name: home, value: (888) 555-1212 , fieldLabel: Business, name: business , fieldLabel: Mobile, name: mobile , fieldLabel: Fax, name: fax , buttons: text: Save, handler: function() this.up(form).getForm().isValid(); , text: Cancel, handler: function() this.up(form).getForm().reset(); ); tabs.render(document.body); /* * = Form 5 = */ bd.createChild(tag: h2, html: Form 5 - . and forms can contain TabPanel(s); var tab2 = Ext.widget( title: Inner Tabs, xtype: form, id: innerTabsForm, collapsible: true, bodyPadding: 5, width: 600, fieldDefaults: labelAlign: top, msgTarget: side , defaults: anchor: 100% , items: xtype: container, layout:hbox, items: xtype: container, flex: 1, border:false, layout: anchor, defaultType: textfield, items: fieldLabel: First Name, afterLabelTextTpl: required, allowBlank: false, name: first, anchor:95% , fieldLabel: Company, name: company, anchor:95% , xtype: container, flex: 1, layout: anchor, defaultType: textfield, items: fieldLabel: Last Name, afterLabelTextTpl: required, allowBlank: false, name: last, anchor:95% , fieldLabel: Email, afterLabelTextTpl: required, allowBlank: false, name: email, vtype:email, anchor:95% , xtype:tabpanel, plain:true, activeTab: 0, height:235, defaults: bodyPadding: 10 , items: title:Personal Details, defaults: width: 230 , defaultType: textfield, items: fieldLabel: First Name, name: first, value: Jamie , fieldLab

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论