ExtJS 4:有没有办法将QuickTip附加到表单字段?

ver*_*4ka 10 extjs extjs4

我正在尝试将QuickTip添加到表单字段,但找不到让我的代码工作的方法.首先,我尝试使用qtip属性

    {
        fieldLabel: 'Last Name',
        qtip:'This tip is not showing at all',
        name: 'last'
    }
Run Code Online (Sandbox Code Playgroud)

然后使用Ext.tip.ToolTip类:

Ext.create('Ext.tip.ToolTip', {
    target: 'rating_field',
    anchor: 'right',
    trackMouse: true,
    html: 'This tip is not showing at all'
});

Ext.QuickTips.init();
Run Code Online (Sandbox Code Playgroud)

这是一个包含源代码的jsfiddle:jsfiddle

Rei*_*ius 23

是的,使用inputAttrTpl配置和data-qtip属性:

{
    fieldLabel: 'Last Name',
    inputAttrTpl: " data-qtip='This is my quick tip!' ",
    name: 'last'
}
Run Code Online (Sandbox Code Playgroud)

  • 看起来很丑陋.为什么他们不能只有"qTip:'我的快速提示'"......嗯 (4认同)

ver*_*4ka 8

我在这里找到答案:我应该如何向ExtJS组件添加工具提示?

    {
        fieldLabel: 'Last Name',
        qtip: "This is a tip",
        name: 'last',
        listeners: {
            render: function(c) {
                Ext.QuickTips.register({
                    target: c.getEl(),
                    text: c.qtip
                });
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

  • 澄清.我想指出,虽然这有效,但它只是一种迂回的方式来做同样的事情.注册"Ext.QuickTips.register"的所有操作都是将data-qtip属性添加到html中.使用这种方式的唯一真正原因是,如果您想要一种更简单的方法来使用动态创建的qtips来转义html. (3认同)