Extjs Combobox无法选择项目

时间:2011-01-06 09:42:28

标签: ajax combobox extjs

暂时没有使用Extjs而且我有点生锈了!

我有以下组合框:

代码:

NameSpace.DirectCombo = Ext.extend(Ext.form.ComboBox, {
    displayField: 'Name',
    valueField: 'Id',
    triggerAction: 'all',
    queryAction: 'Name',
    forceSelection: true,
    mode: 'remote',
    initComponent: function () {
        this.store = new Ext.data.DirectStore(Ext.apply({
            api: this.api,
            root: 'data',
            fields: this.fields || ['Name', 'Id']
        }, this.storeConfig));

        NameSpace.DirectCombo.superclass.initComponent.call(this);
    }
});

NameSpace.LocationCombo = Ext.extend(NameSpace.DirectCombo, {
    storeConfig: {
        id: 'location-combo-store'
    },
    initComponent: function () {
        Ext.apply(this.storeConfig, {
            directFn: Location.AllHasLineupList,
            baseParams: { Id: selectedNodeId }
        });
        NameSpace.LocationCombo.superclass.initComponent.call(this);
    }
});

加载并完成整个类型的事情。

但是当我尝试在建议中选择一个项目时,它不会选择它!

我在这里做错了什么?

2 个答案:

答案 0 :(得分:0)

尝试这些属性的组合,然后您获得typeahead并允许选择:

答案 1 :(得分:0)

对于您那些失去希望的Google员工,您是否正在使用Ext 5.1.x和Firefox?您可以使用Ext.getVersion().version

进行检查

ext forum上报告了一个错误,该错误可以通过升级到5.1.5或使用以下代码段进行修复:

Ext.define('EXTJS_23846.Element', {
    override: 'Ext.dom.Element'
}, function (Element) {
    var supports = Ext.supports,
        proto = Element.prototype,
        eventMap = proto.eventMap,
        additiveEvents = proto.additiveEvents;

    if (Ext.os.is.Desktop && supports.TouchEvents && !supports.PointerEvents) {
        eventMap.touchstart = 'mousedown';
        eventMap.touchmove = 'mousemove';
        eventMap.touchend = 'mouseup';
        eventMap.touchcancel = 'mouseup';

        additiveEvents.mousedown = 'mousedown';
        additiveEvents.mousemove = 'mousemove';
        additiveEvents.mouseup = 'mouseup';
        additiveEvents.touchstart = 'touchstart';
        additiveEvents.touchmove = 'touchmove';
        additiveEvents.touchend = 'touchend';
        additiveEvents.touchcancel = 'touchcancel';

        additiveEvents.pointerdown = 'mousedown';
        additiveEvents.pointermove = 'mousemove';
        additiveEvents.pointerup = 'mouseup';
        additiveEvents.pointercancel = 'mouseup';
    }
});

Ext.define('EXTJS_23846.Gesture', {
    override: 'Ext.event.publisher.Gesture'
}, function (Gesture) {
    var me = Gesture.instance;

    if (Ext.supports.TouchEvents && !Ext.isWebKit && Ext.os.is.Desktop) {
        me.handledDomEvents.push('mousedown', 'mousemove', 'mouseup');
        me.registerEvents();
    }
});