如何在extjs6中的文本格式字段中添加工具提示 [英] How to add tooltip to text form field in extjs6
问题描述
我有创建/渲染输入字段的功能,但我不知道如何在EXTjs6中添加工具提示。
I have function for creating/rendering input fields but i don't know how to add tool tip on it in EXTjs6
这是我的功能:
createInputField: function(value, fieldsMarginBottom, readonly) {
var fieldStyle = this.getFieldStyle(readonly);
var nameField = Ext.create('Ext.form.field.Text', {
name: 'name',
readOnly: true,
hideLabel: true,
value: value,
width: this.fieldWidth,
style: {
marginBottom: fieldsMarginBottom + 'px'
},
//My try which is not working
tooltip: {
trackMouse: true,
width: 140,
renderer: function(tip, item){
tip.setTitle('name');
tip.update('Count: ');
}
},
fieldStyle: fieldStyle
});
return nameField;
}
我希望你们可以帮助我。如果您需要任何其他信息,请告诉我,我会提供。谢谢
I hope you guy can help me. If you need any additional informations, please let me know and i will provide. Thank you
推荐答案
从 textfield
docs ,字段没有办法添加一个工具提示他们的配置,所以你必须手动创建工具提示。
As can be seen in the textfield
docs, fields do not have a way to add a tooltip to their configuration, so you would have to create the tooltip manually.
如果你看 Ext.tip.ToolTip
的文档如何做那你可能会发现一个小例子,你只需要按照 目标
配置说明:
If you look at the docs for Ext.tip.ToolTip
how to do that, you may find a small example, where you just have to change the target as per the target
configuration description:
var tip = Ext.create('Ext.tip.ToolTip', {
target: nameField.getEl(),
html: 'Press this button to clear the form'
});
这篇关于如何在extjs6中的文本格式字段中添加工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!