重写 Ext.form.field 扩展功能
直接代码,放项目overrides文件夹中即可
//重写类 表单父类
//支持allowBlank动态绑定
Ext.define("override.form.field.Base", {
override: "Ext.form.field.Base",
//标签文字右对齐
labelAlign: 'right',
setAllowBlank: function (value) {
this.allowBlank = value;
//如果不验证必填项,执行一下验证方法用来去掉警告
if (value) {
this.isValid();
}
}
});
//重写类 文本框
//汉化
//输入长度限制
//必填项自动标红加*
//修改必填项错误提示,提示更直观
Ext.define("override.form.field.Text", {
override: "Ext.form.field.Text",
invalidText: '输入内容无效',
minLengthText: '最少输入{0}个字符',
maxLengthText: '最多输入{0}个字符',
blankText: '此项是必填项',
//设置提示信息在文本框下方显示
msgTarget: 'under',
//默认最大长度限制
maxLength: 100,
//输入过滤
maskRe: /[_ %-@.a-zA-Z0-9\u4e00-\u9fa5]/,
initComponent: function () {
var me = this,
label;
me.callParent(arguments);
if (me.fieldLabel) {
//过滤掉空格字符
label = me.fieldLabel.replace(/&..sp;/g, '');
if (!me.emptyText) {
//自动设置空值提示
me.emptyText = '请输入' + label;
}
//必填项自动标红加*
if (me.allowBlank === false) {
//自动设置必填提示
me.blankText = label + '为必填项';
me.fieldLabel = '<font color=red>*</font>' + me.fieldLabel;
}
}
}
});
重写 Ext.form.field 扩展功能的更多相关文章
- Ext.form.field.Picker (ComboBox、Date、TreePicker、colorpick.Field)竖向滚动导致布局错误
ComboBox.Date.TreePicker.colorpick.Field这些继承了Ext.form.field.Picker的控件. 在6.0.0和6.0.1中,在界面中存在竖向滚动条时,点击 ...
- ExtJs之Ext.form.field.TimePicker DatePicker组合框
<!DOCTYPE html> <html> <head> <title>ExtJs</title> <meta http-equiv ...
- ExtJs之Ext.form.field.ComboBox组合框
<!DOCTYPE html> <html> <head> <title>ExtJs</title> <meta http-equiv ...
- ExtJS4.2学习(17)表单基本输入控件Ext.form.Field(转)
鸣谢:http://www.shuyangyang.com.cn/jishuliangongfang/qianduanjishu/2013-12-11/189.html --------------- ...
- ExtJs Ext.form.field.TextArea+Ckeditor 扩展富文本编辑器
Ext.define("MyApp.base.BaseTextArea", { extend: "Ext.form.field.TextArea", xtype ...
- 47. Ext.form.Field.prototype.msgTarget
转自:https://blog.csdn.net/a1542aa/article/details/24295791 ExtJS.form中msgTarget Ext表单提示方式:msgTarget:有 ...
- 学习EXTJS6(8)基本功能-表单的基础表字段Ext.form.field.Basic
Ext.form.field.Basic是表单字段的基类. Ext.form.field.Text Ext.form.field.TextArea Ext.form.field.Number Ext. ...
- 重写 Ext.toolbar.Paging 扩展功能
直接代码,放项目overrides文件夹中即可 //重写类 分页插件 //汉化 //默认下方布局 //默认显示额外信息 //当删除数据时,处理页面变化 Ext.define("overrid ...
- Javascript - ExtJs - Ext.form.Panel组件
FormPanel组件(Ext.form.FormPanel) logogram:Ext.form.Panel | xtype:form Ext.form.Panel.配置 frame }//旗下所有 ...
随机推荐
- PostgreSQL学习手册(角色和权限)
原文地址:http://www.cnblogs.com/stephen-liu74/archive/2012/05/18/2302639.html PostgreSQL是通过角色来管理数据库访问权限的 ...
- python接口自动化28-requests-html爬虫框架
前言 requests库的好,只有用过的人才知道,最近这个库的作者又出了一个好用的爬虫框架requests-html.之前解析html页面用过了lxml和bs4, requests-html集成了一些 ...
- .Net Core AES加密解密
一.AES说明 高级加密标准(英语:Advanced Encryption Standard,缩写:AES),在密码学中又称Rijndael加密法,是美国联邦政府采用的一种区块加密标准.这个标准用来替 ...
- hash bucket
什么是bucket bucket的英文解释: Hash table lookup operations are often O(n/m) (where n is the number of objec ...
- 微软BI SSIS 2012 ETL 控件与案例精讲课程学习方式与面试准备详解
开篇介绍 微软BI SSIS 2012 ETL 控件与案例精讲 (http://www.hellobi.com/course/21) 课程从2014年9月开始准备,到2014年12月在 天善BI学院 ...
- 不依赖三方库从图像数据中获取宽高-gif、bmp、png、jepg
int extract_pic_info(const BYTE *pic, const uint32_t size, int &width, int &height) { ; widt ...
- 【strpos】php的strpos的坑,记一次
php > var_dump(strpos('开始23测试ceshi', '测试')); int(8) php > var_dump(mb_strpos('开始23测试ceshi', '测 ...
- Sort_Buffer_Size 设置对服务器性能的影响
基础知识: 1. Sort_Buffer_Size 是一个connection级参数,在每个connection第一次需要使用这个buffer的时候,一次性分配设置的内存.2. Sort_Buffer ...
- python hex() oct() bin() math 内置函数
示例: print hex(20),hex(-20) #转换成十六进制 print oct(20),oct(-20) #转换成八进制 print bin(20),bin(-20) #转换成二进制 pr ...
- Android 组件系列-----Activity生命周期
本篇随笔将会深入学习Activity,包括如何定义多个Activity,并设置为默认的Activity.如何从一个Activity跳转到另一个Activity,还有就是详细分析Activity的生命周 ...