Javascript 如何向extjs6中的文本表单字段添加工具提示

Javascript 如何向extjs6中的文本表单字段添加工具提示,javascript,extjs,extjs6,Javascript,Extjs,Extjs6,我有创建/呈现输入字段的功能,但我不知道如何在EXTjs6中添加工具提示 这是我的职责: createInputField: function(value, fieldsMarginBottom, readonly) { var fieldStyle = this.getFieldStyle(readonly); var nameField = Ext.create('Ext.form.field.Text', { name: 'name'

我有创建/呈现输入字段的功能,但我不知道如何在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;
    }
我希望你们能帮助我。如果您需要任何其他信息,请让我知道,我会提供。谢谢

如中所示,字段无法将工具提示添加到其配置中,因此您必须手动创建工具提示

如果您了解如何做到这一点,您可能会发现一个小示例,您只需按照以下步骤更改目标:

如中所示,字段无法向其配置中添加工具提示,因此必须手动创建工具提示

如果您了解如何做到这一点,您可能会发现一个小示例,您只需按照以下步骤更改目标:


以上答案是正确的。下面是一个通用函数的示例,您只需编写一次,就可以在项目中的任何需要的地方使用属性

addToolTip : function (id, msg) {
    new Ext.ToolTip({
            target : id,
            dismissDelay : 0,
            anchor : 'right',
            html : msg
        });
};

以上答案是正确的。下面是一个通用函数的示例,您只需编写一次,就可以在项目中的任何需要的地方使用属性

addToolTip : function (id, msg) {
    new Ext.ToolTip({
            target : id,
            dismissDelay : 0,
            anchor : 'right',
            html : msg
        });
};

你在哪里找到工具提示配置的?我没有。我在谷歌上搜索怎么做,但似乎什么都不管用。你知道如何实现这个吗?你在哪里找到了工具提示配置?我没有。我在谷歌上搜索怎么做,但似乎什么都不管用。你知道如何实施吗?谢谢!这是我第一次使用EXTJS,我不知道你可以这样引用target谢谢!这是我第一次使用EXTJS,我不知道你可以这样引用target