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. JS获取服务器时间并且计算距离当前指定时间差的函数

    项目中遇到了从服务器获取时间,现在记录一下方便以后查询: 1.后台代码:(创建一个date对象并以JSON的形式返回去) // 获取服务器时间 public String getNowServerTi ...

  2. Object_c tabbar菜单栏在切换的时候,颜色变灰的问题

    在界面切换的时候,有时候tabbar整条颜色都会变灰,如下: 而正常的应该如下: 在所有的父类加上: self.navigationController.navigationBar.transluce ...

  3. Java中@SuppressWarnings注解用法(转)

    背景: J2SE提供的最后一个注解是@SuppressWarnings.该批注的作用是给编译器一条指令,告诉它对被批注的代码元素内部的某些警告保持静默. @SuppressWarnings注解允许您选 ...

  4. 一句话从MySQL导出CSV文件

    mysql -h <host> -u<user> -p<passport> crm -e "select ....." | csvcut -t ...

  5. poj 1695 Magazine Delivery 记忆化搜索

    dp[a][b][c],表示三个人从小到大依次在a,b.c位置时.距离结束最少的时间. 每次选一个人走到c+1位置搜索就好了. 坑点在于不能floyd.预计题目没说清楚.意思就是假设没送Li,那么Li ...

  6. Binder IPC的权限控制

    PS:个人理解:当进程1通过Binder调用组件2时,会将进程1的pid及uid赋给组件2,并检测进程1的pid及uid是否有权限调用组件2.而后组件2需要调用组件3,此时组件2保存的pid及uid为 ...

  7. Scrum 每日站会

    站立式会议(Daily Scrum, 有时候我们直接叫做Daily Meeting)是Scrum敏捷软件开发方法学的实践之一,也是团队最容易实施的敏捷实践,实施成本低. 具体做法,团队成员每天固定时间 ...

  8. 【HRS项目】Axure兴许问题解决---与SVN结合

    上一篇博客介绍了Axure的团队开发用法,http://blog.csdn.net/u013036274/article/details/50999139,可是再用的时候发现会出现这种问题,例如以下图 ...

  9. 创业公司做数据分析(四)ELK日志系统

      作为系列文章的第四篇.本文将重点探讨数据採集层中的ELK日志系统.日志.指的是后台服务中产生的log信息,一般会输入到不同的文件里.比方Django服务下,一般会有nginx日志和uWSGI日志. ...

  10. MySQL运行计划不准确 -概述

    为毛 MySQL优化器的运行计划 好多时候都不准确,不是最优的呢(cpu+io)??? 因素太多了:: 存在information_schema的信息是定期刷新上去的,好多时候不是最真的,甚至相差好大 ...