form表单中多选框和复选框

Ext.require([
'Ext.form.*',
'Ext.layout.container.Column',
'Ext.window.MessageBox',
'Ext.fx.target.Element'
]); Ext.onReady(function () { var individual = {
xtype: 'container',
layout: 'hbox',
margin: '0 0 10',
items: [{
xtype: 'fieldset',
flex: 1,
title: 'Indiviual Checkboxed', //geren checkbox
defaultType: 'checkbox',
defaults: {
anchor: '100%',
hideEmptyLabel: false //fieldLabel 当没有设置fieldLabel 的时候,fieldLabel空间会被保留
},
items: [{
xtype: 'textfield',
name: 'text-test1',
fieldLabel: 'Alignment Test'
}, {
fieldLabel: 'Favorite Animals',
boxLabel: 'Dog',
name: 'fav-animal-dog', //
inputValue: 'dog'
}, {
boxLabel: 'Cat',
name: 'fav-animal-cat', //
inputValue: 'cat'
}, {
checked: true, //默认选中
boxLabel: 'Monkey',
name: 'fav-animal-monkey', //
inputValue: 'monkey'
}]
}, {
xtype: 'component',
width: 10
}, {
xtype: 'fieldset',
flex: 1,
title: 'Individual Radios', //个人radio
defaultType: 'radio',
layout: 'anchor',
defaults: {
anchor: '100%',
hideEmptyLabel: false
},
items: [{
xtype: 'textfield',
name: 'txt-test2',
fieldLabel: 'Alignment Test'
}, {
checked: true,
fieldLabel: 'Favorite Color',
boxLabel: 'Red',
name: 'fav-color',
inputValue: 'Red'
}, {
boxLabel: 'Blue',
name: 'fav-color',
inputValue: 'blue'
}, {
boxLabel: 'Green',
name: 'fav-color',
inputValue: 'green'
}]
}] }; var fp = Ext.create('Ext.FormPanel', {
title: 'Check/Radio Groups Example',
frame: true,
fieldDefaults: {
labelWidth: 110,
labelStyle: 'color:green,padding-left:4px'
},
width: 600,
renderTo:Ext.getBody(),
bodyPadding: 10,
items: [
individual
],
buttons: [{
text: 'Save',
handler: function () {
         //fp.getForm()返回的Ext.form.Basic对象。
if (fp.getForm().isValid()) {
Ext.Msg.alert('Submited Values', 'The fllowing wll be sent to the server:<br/>' +
fp.getForm().getValues(true).replace(/&/g, ', ')
);
}
}
}, {
text: 'Reset',
handler: function () {
fp.getForm().reset();
}
}]
}); });

Ext.form.Basic

检索字段作为一组键/值对的形式,用自己的getSubmitData()方法来收集值。如果多个领域相同的名称下返回值,这些值将被组合成一个阵列。这是类似于getFieldValues​​的但该方法只收集提交的字符串值,而getFieldValues​​收集特定类型的数据值(如Date对象的日期字段)。

checkboxgroup

var checkGroup = {
xtype: 'fieldset',
title: 'CheckBox Groups (initially collapsed)',
layout: 'anchor',
defaults: {
anchor: '100%'
},
collapsible: true, //可折叠的
collapsed: false, //true:fieldset的状态 默认是折叠起来的 false:展开
items: [{
xtype: 'textfield',
name: 'text-test3',
fieldLabel: 'Alignment Test' //队列测试
}, {
//Use the default,auomtic layout to distribute the controls evenly
//across a single row 横向导航
xtype: 'checkboxgroup',
fieldLabel: 'Auto Layout', //自动布局
cls: 'x-check-group-alt',
items: [
{ boxLabel: 'Item1', name: 'cb-auto-1' },
{ boxLabel: 'Item2', name: 'cb-auto-2', checked: true },
{ boxLabel: 'Item3', name: 'cb-auto-3' },
{ boxLabel: 'Item4', name: 'cb-auto-4' },
{ boxLabel: 'Item5', name: 'cb-auto-5' }
]
}, {
xtype: 'checkboxgroup',
fieldLabel: 'Single Column',
//put all controls in a single column with width 100% 把所有控件放在一行里 宽度100%
columns: 1, //每行显示一列
items: [
{ boxLabel: 'Item 1', name: 'cb-col-1' },
{ boxLabel: 'Item 2', name: 'cb-col-2', checked: true },
{ boxLabel: 'Item 3', name: 'cb-col-3' }
]
}, {
xtype: 'checkboxgroup',
fieldLabel: 'Muti-Column (horizontal)', //多列 对行
cls: 'x-check-group-alt',
//Distribute controls across 3 even columns,filling each row //平等分配成三行
//form left to right before starting the next row
columns: 3, //每行显示三列
items: [
{ boxLabel: 'Item 1', name: 'cb-horiz-1' },
{ boxLabel: 'Item 2', name: 'cb-horiz-2' },
{ boxLabel: 'Item 3', name: 'cb-horiz-3' },
{ boxLabel: 'Item 4', name: 'cb-horiz-4' },
{ boxLabel: 'Item 5', name: 'cb-horiz-5' }
]
}, {
xtype: 'checkboxgroup',
fieldLabel: 'Muti-Column<br />(custom widths)',
cls: 'x-check-group-alt',
//Specify exact column widths(could also include float values for %)
//制定确切的列宽 (也可以用百分比)
columns: [100, 100], //每行两列 每列宽度100
vertical: true,
items: [
{ boxLabel: 'Item 1', name: 'cb-custwidth', inputValue: 1 },
{ boxLabel: 'Item 2', name: 'cb-custwidth', inputValue: 2, checked: true },
{ boxLabel: 'Item 3', name: 'cb-custwidth', inputValue: 3 },
{ boxLabel: 'Item 4', name: 'cb-custwidth', inputValue: 4 },
{ boxLabel: 'Item 5', name: 'cb-custwidth', inputValue: 5 }
]
}, {
xtype: 'checkboxgroup',
fieldLabel: 'Custom Layout <br />(w/ validation)',
allowBlanl: false,
msgTarget: 'side',
autoFitErrors: false,
anchor: '-18',
//You can change the 'layout' to anything you want,and include any nested(嵌套)
//container structure(结构,构造),for complete layout control.In this example we only
//want one item in the middle column,which would not be possible using the
//default 'checkboxgroup' layout's columns config.we also want to put
//heading at the top of each column
layout: 'column',
defaultType: 'container',
items: [{
columnWidth: .25,
items: [
{ xtype: 'component', html: 'Heading 1', cls: 'x-form-check-group-label' },
{ xtype: 'checkboxfield', boxLabel: 'Item 1', name: 'cb-cust-1' },
{ xtype: 'checkboxfield', boxLabel: 'Item2', name: 'cb-cust-2' }
]
}, {
columnWidth: .5,
items: [
{ xtype: 'component', html: 'Heading 2', cls: 'x-form-check-group-label' },
{ xtype: 'checkboxfield', boxLabel: 'A long item just for fun', name: 'cb-cust-3' }
]
}, {
columnWidth: .25,
items: [
{ xtype: 'component', html: 'Heading 3', cls: 'x-form-check-group-label' },
{ xtype: 'checkboxfield', boxLabel: 'Item 4', name: 'cb-cust-4' },
{ xtype: 'checkboxfield', boxLabel: 'Item 5', name: 'cb-cust-5' } ]
}]
}]
};

ExtJS Form的更多相关文章

  1. Extjs Form用法详解(适用于Extjs5)

    Extjs Form是一个比较常用的控件,主要用来显示和编辑数据的,今天这篇文章将介绍Extjs Form控件的详细用法,包括创建Form.添加子项.加载和更新数据.验证等. 本文的示例代码适用于Ex ...

  2. 2014年12月20日00:33:14-遮罩+进度条-extjs form.isvalid

    1.Extjs : 遮罩+进度条 2.Extjs: extjs form.isvalid http://stackoverflow.com/questions/19354433/extjs-form- ...

  3. 实用ExtJS教程100例-011:ExtJS Form 使用JSON数据赋值和取值

    上一节中我们演示了ExtJS Form的异步加载和提交数据,本节中我们将演示如何使用JSON数据为ExtJS Form中的字段赋值和取值. 系列ExtJS教程持续更新中,点击查看>>最新E ...

  4. 实用ExtJS教程100例-010:ExtJS Form异步加载和提交数据

    ExtJS Form 为我们提供了两个方法:load 和 submit,分别用来加载和提交数据,这两个方法都是异步的. 系列ExtJS教程持续更新中,点击查看>>最新ExtJS教程目录 F ...

  5. 实用ExtJS教程100例-009:ExtJS Form无刷新文件上传

    文件上传在Web程序开发中必不可少,ExtJS Form中有一个filefield字段,用来选择文件并上传.今天我们来演示一下如何通过filefield实现ExtJS Form无刷新的文件上传. 首先 ...

  6. Extjs form 表单的 submit

    说明:extjs form表单的提交方式是多种多样的,本文只是介绍其中的一种方法,本文介绍的方法可能不是完美的,但是对于一般的应用应该是没有问题的.     本文包括的主要内容有:form面板设计.f ...

  7. extjs form.load()加载服务端数据

    formPanel.getForm().load({ url: 'getApproveRefundInf?refundIdDetail=${refundIdDetail}', waitMsg: '请稍 ...

  8. extjs form 取值 赋值 重置

    一.从form中获取field的三个方法: 1.Ext.getCmp('id'); 2.FormPanel.getForm().findField('id/name'); 3.Ext.get('id/ ...

  9. 93.EXTJS Form之VTypes

    转自:http://blog.sina.com.cn/s/blog_7778950d0100y2pg.html 本文我们主要探讨一下EXTJS的Form中验证的问题,可能用过EXTJS的Form的人都 ...

  10. extjs form submit 总是执行failure

    代码: function createWeekReort() { if (form.getForm().isValid()) { Ext.Msg.confirm("提示", &qu ...

随机推荐

  1. 关于HTML文件、JS文件、CSS文件

    把JS和CSS脚本写在html里和写在独立文件里有什么区别? 1. 都写在html里是性能最优的方案. 2. 都写在html里是可维护性最差的方案. 3. 分开写在js.css.html是可维护性最有 ...

  2. Linux 端口开放

    Linux(CentOS): 系统缺省值为32768-61000. 修改方法: 在/etc/sysctl.conf中,增加以下配置:(开放20000-50000为完成端口) net.ipv4.ip_l ...

  3. poj3635 FULL tank(TLE) 有限制的最短路(BFS搜索)。

    用的BFS+优先队列+二进制压缩状态判重+链式前向星, TLE,好像有人这样过了...好像要用A*算法,还不太会,所以暂时放弃.但是也学会了很多,学习了链式前向星,更深理解了BFS求最优的时候,什么时 ...

  4. Python 列表的复制操作

    2013-10-18 10:07:03|   import copy a = [1,2,3,['a','b']] b = a c = a[:] d = copy.copy(a) e = copy.de ...

  5. java基础语法——方法,static关键字

    一:方法: 1.什么是方法: 通俗地讲,方法就是行为.它是完成特定功能的代码块能执行一个功能.它包含于类和对象中. 2.为什么要有方法: *提高代码的复用性. *提高效率 *利于程序维护 3.命名规则 ...

  6. final finally finalize 区别及用法

    final 1,final修饰的class,代表不可以继承扩展. 2.final的方法也是不可以重写的. 3.final修饰的变量是不可以修改的.这里所谓的不可修改对于基本类型来来,的确是不可以修改. ...

  7. Ubuntu 16.04关闭Alt+鼠标左键移动窗口(转)

    1.打开终端,菜单-编辑-配置文件首选项-命令,勾上“以登录Shell方式运行命令”,重启终端. 2.在终端输入 gsettings get org.gnome.desktop.wm.preferen ...

  8. Java实现拖拽上传

    原文:http://www.open-open.com/code/view/1437358795584 在项目开发中由于实际需求,需要开发拖拽上传的功能,ok! 先看效果图: jsp上传前端代码: & ...

  9. delphi 修改文件夹名和文件名

    unit Unit1; interface uses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Form ...

  10. 什么是WPF? 秒懂 !

    一開始听到WPF.认为非常陌生.在百度百科等地方看完简单介绍之后.感觉更深奥.各种不懂啊! 在简单做了几个页面之后,发现.原来如此! So Easy 但又So Magic. 为什么说它简单?由于它简直 ...