Verwenden Sie extjs? Wenn ja, hier ist meine Antwort:
Sie müssen benutzerdefinierte QuickInfo erstellen, um das Standardmouseover-Ereignis zu deaktivieren.
Ext.define('nutnull.ToolTip', function() {
return {
extend: 'Ext.tip.ToolTip',
xtype: 'nutnull-tooltip',
// Set this as emptyFn so that it will not create mouse event to show the tooltip
setTarget: Ext.emptyFn
};
});
Dann können Sie das Textfeld überschreiben Tooltip während der Fokus Ereignis zu zeigen.
Ext.define('nutnull.override.Text', {
override: 'Ext.form.field.Text',
tip: null,
onFocus: function() {
// show tooltip if exist
if(this.tip) {
if(!this.tipCmp) {
this.tipCmp = Ext.create('nutnull.ToolTip', {
target: this.id,
html: this.tip
});
}
// Get the position of the textfield instead of mouse position
this.tipCmp.targetXY = this.getPosition();
// Adjust the position.
this.tipCmp.targetXY[0] += this.getWidth();
this.tipCmp.targetXY[1] -= (this.getHeight()/2);
// Manually show the tooltip
this.tipCmp.show();
}
this.callParent(arguments);
}
});
In das Textfeld ein Element, fügen Sie einfach tip: 'Sample Description'
Config.
{
xtype: 'textfield',
fieldLabel: 'Name',
tip: 'Sample Description'
}
Ich benutze gxt, aber vielen Dank für die Antwort :) Ich löste dieses Problem :) – firstontheworld