Ext JS4百强应用:设置textfield的悬浮提示信息 --第8强

在Extjs4中有时候我们需要textfield的提示信息,但是我们发现textfield并没有这样的配置项。

这时候我们就要另想方法:我们需要在鼠标悬停在textfield组件的时候进行信息的提示,我们就需要在textfield中来监听,


这里有两种进行textfield悬停提示的方法:


①进行固定信息的提示:需要在监听中用render方法
render: function (field, p) {
Ext.QuickTips.init();
Ext.QuickTips.register({
target: field.el,
text: '这是textfield的固定信息提示!'
})
}
②进行文本信息提示:提示信息为textfield的文本信息
var updateTip = function (field, t) {
Ext.QuickTips.init();
Ext.QuickTips.register({
target: field.el,
text: field.getValue()
})
};

listeners: {
focus: function (me) {
updateTip(me);
},
keyup: updateTip

}


原文地址:https://www.cnblogs.com/snake-hand/p/3149593.html