重写ext的TextField控件,增加鼠标悬浮提示和控件后加说明文字
来源:互联网 发布:别人用我身份证开淘宝 编辑:程序博客网 时间:2024/06/08 06:07
在使用ext的过程中,有时需要在TextField后加上说明性文字和鼠标悬浮提示的需求,在网上找到相关资料在整合了下
Ext.override(Ext.form.TextField, {
followtext: {text:'',class:''}, //控件后说明内容,可以自己增加项tooltip: {text:'',title:''}, //鼠标悬浮提示,可以自己增加项
onRender: function (ct, position) {
Ext.form.TextField.superclass.onRender.call(this, ct, position);
var followlength = 0; //字符占位长度px
if (this.followtext.text != '') {
this.followEl = ct.createChild({
tag: 'div',
html: this.followtext.text
});
if (this.followtext.class)
this.followEl.addClass(this.followtext.class);
else
this.followEl.addClass('x-form-follow');
followlength = this.followtext.text.replace(/[^\x00-\xff]/g, "xx").length * 6 + 2;
this.width = this.width - followlength;
this.alignErrorIcon = function () {
this.errorIcon.alignTo(this.followEl, 'tl-tr', [2, 0]);
};
}
//鼠标移到文本框上时提示
if (this.tooltip.text) {
new Ext.ToolTip({
target: this.id,
trackMouse: false,
draggable: true,
maxWidth: 200,
minWidth: 100,
title: this.tooltip.title,
html: this.tooltip.text
});
}
}
});
效果:
- 重写ext的TextField控件,增加鼠标悬浮提示和控件后加说明文字
- ExtJS4.2的FormPanel中TextField的鼠标悬浮提示
- Ext实现鼠标悬浮提示
- 增加duilib edit控件的提示功能和多种文字颜色
- 去掉Eclipses的鼠标悬浮提示和增加输代码提示
- 鼠标放到控件上 DIV悬浮提示效果(四种)
- Ext JS4百强应用:设置textfield的悬浮提示信息 --第8强
- Extjs中textfield的悬浮提示
- MFC界面控件增加鼠标浮动上去的提示功能:CToolTipCtrl
- 图片加文字的自定义控件
- 控件加提示
- Ext.TextField自定义验证函数以及提示文字
- NET 用户控件 文件上传,并给图片文件加水印(增加文字水印文字设置)
- Extjs中如何在一行textfield后面增加文字提示
- Button和Textfield 及其控件
- Cocos2dx控件 Text和TextField
- 闪动的文字和文字进度条控件
- 点击radio控件后的文字,选中控件
- new有三种使用方式:plain new、nothrow new、placement new.
- Linux下通过共享内存进行进程间通信,进程间同步使用信号量来实现
- AsyncTask
- IT职场人生系列之二十:危险职业(续1)
- 摄影测量知识日积月累
- 重写ext的TextField控件,增加鼠标悬浮提示和控件后加说明文字
- WebSVN(2.3.3)查看文件中文乱码解决方法
- 应用被苹果商店拒绝审核通过的原因积累
- MFC添加消息、隐藏对话框项目界面
- 产品经理的核心价值和工作边界
- 程序员的生存法则,转自碎碎念
- Java线程安全总结(包含生产者和消费者例子)
- Spring 连接池之 DBCP
- No result defined for action com.zhen.user.UserInfoAction and result success