Extjs键盘选择中的组合框Quicktips

时间:2011-10-26 08:09:35

标签: javascript extjs combobox keyboard

我创建了组合框并通过在模板中插入'qtip'属性来插入QuickTips(就像在this问题中一样)。 一切正常,但QuickTips在键盘遍历组合框列表时没有显示。

有人知道在通过键盘遍历组合列表时如何启用QuickTips吗? 我使用的是extjs-3.4.0 感谢。


我的组合是:

Ext.extend(Ext.form.ComboBox, {
    tpl:'<tpl for="."><div ext:qtip="{tooltip}" class="x-combo-list-item">{item}</div></tpl>',
    selectPrev:function () {
        var ct = this.store.getCount();
        var idx = 0;
        if (ct > 0) {
            if (this.selectedIndex == -1) {
                this.select(0);
            } else if (this.selectedIndex !== 0) {
                idx = this.selectedIndex - 1;
                this.select(this.selectedIndex - 1);
            }
            var el = this.view.getNode(idx);
            if (el)
                eventFire(el, "mouseover");
        }
    },
    selectNext:function () {
        var ct = this.store.getCount();
        var idx = 0;
        if (ct > 0) {
            if (this.selectedIndex == -1) {
                this.select(0);
            } else if (this.selectedIndex < ct - 1) {
                idx = this.selectedIndex + 1;
                this.select(idx);
            }
            var el = this.view.getNode(idx);
            if (el)
                eventFire(el, "mouseover");
        }
    },

    onViewOver:function (e, t) {

        var item = this.view.findItemFromChild(t);
        if (item) {
            var index = this.view.indexOf(item);
            this.select(index, false);
        }
    }
});

1 个答案:

答案 0 :(得分:0)

快速提示使用鼠标事件来定位qtip,这就是为什么这不会自动发生的原因。听起来你可能需要编写一些自定义代码来实现这一点。

我会尝试将一个适当的事件的监听器附加到组合(或者可能是组合的选择器)并使用Ext.Element函数(例如,alignTogetPosition)来定位你需要它的qtip。您甚至可能无法直接使用QTip管理器,并且可能必须自定义Ext.Tip。

如果您需要更多详细信息,或者您遇到困难并想要一些额外的提示,请告诉我。