Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript ExtJS3.4:为组合框设置工具提示_Javascript_Extjs_Combobox_Tooltip - Fatal编程技术网

Javascript ExtJS3.4:为组合框设置工具提示

Javascript ExtJS3.4:为组合框设置工具提示,javascript,extjs,combobox,tooltip,Javascript,Extjs,Combobox,Tooltip,我有一个ExtJs组合框,如下所示。我使用的是ExtJS3.4。我需要为这个组合框设置悬停文本。i、 e.当用户将鼠标悬停在此组合框上时,应显示消息文本 new Ext.form.ComboBox({ store : driverStore, displayField : 'dName', valueField : 'dName', fieldLabel : 'Driver Name', id : 'driverco

我有一个
ExtJs
组合框,如下所示。我使用的是ExtJS3.4。我需要为这个组合框设置悬停文本。i、 e.当用户将鼠标悬停在此组合框上时,应显示消息文本

new Ext.form.ComboBox({
        store : driverStore,
        displayField : 'dName',
        valueField : 'dName',
        fieldLabel : 'Driver Name',
        id : 'drivercombo',
        allowBlank : false,
        typeAhead : true,
        forceSelection : true,
        mode : 'local',
        triggerAction : 'all',
        selectOnFocus : true,
        editable : false,
        hidden : false,
        disabled : true,
        minChars : 1,
        hideLabel : true,
        style : 'marginleft:10px',
        //width : 147,
        emptyText : 'Driver Name',
        flex : 1
    });
我知道有一种方法可以为下拉菜单的组合框项目设置此工具提示消息。但我不想要它。我想要一个组合框的工具提示


我应该怎么做?

您可以在侦听器中为
组合框
渲染
事件创建
Ext.ToolTip
,作为
工具提示
目标,您可以定义组合框元素

var combo = new Ext.form.ComboBox({
    mode: 'local',
    renderTo: Ext.getBody(),
    store: new Ext.data.ArrayStore({
        id: 0,
        fields: [
            'myId',
            'displayText'
        ],
        data: [[1, 'item1'], [2, 'item2']]
    }),
    listeners: {
        render: function(c) {
          new Ext.ToolTip({
            target: c.getEl(),
            html: 'Tooltip content'
          });
        }
    },    
    valueField: 'myId',
    displayField: 'displayText'
});  

摆弄示例:

将它放在组合框的侦听器中,它在我身边工作

Ext.onReady(function() {

Ext.QuickTips.init();
    var combo = new Ext.form.ComboBox({
        mode: 'local',
        renderTo: Ext.getBody(),
        store: new Ext.data.ArrayStore({
            id: 0,
            fields: ['id', 'displaytext'],
            data: [
                [1, 'Vinayak']
            ]
        }),
        listeners: {
            render: function(c) {
                 Ext.QuickTips.register({ target: this.getEl(), 
                 text: 'Tooltip Data' });
            }
        },
        valueField: 'id',
        displayField: 'displaytext'
    });

});
你必须写作


Ext.QuickTips.init()
;在
Ext.Ready

上没有悬停事件,没有机会!阿卡塔姆山。这正是我想要的。Aktum,你能解释一下为什么需要在渲染侦听器中添加工具提示吗?是的,它不会以其他方式工作,我无法理解为什么。这是因为您必须将工具提示绑定到DOM中的元素。因此,在这种情况下,您必须将工具提示绑定到表示此组合框组件的顶级元素。在呈现combobox之前,此元素不存在。