1

选择侦听器仅触发一次。第二次单击时返回并附加触发属性:false。我怎样才能防止这种情况发生?

这是一个例子:http ://supraliminalsolutions.com/pages/example-apps/campusBuildings/

        xtype: 'combo',
        store: ds,
        displayField: 'title',
        typeAhead: false,
        hideLabel: true,
        hideTrigger:true,
        anchor: '100%',
        minChars: 1,
        listConfig: {
            loadingText: 'Searching...',
            emptyText: 'No matching buildings found.',

            // Custom rendering template for each item
            getInnerTpl: function() {
                return '<div class="search-item">{name}</div>';
            }
        },
        pageSize: 10,

        // override default onSelect to do redirect
        listeners: {
            'select': function(combo, selection) {
                console.log('you there?');
                var building = selection[0];
                if (building) {

                    retrieveBuildingInfo(Ext.String.format(env_url + 'building.php?id={0}', building.get('id')));
                }
            },
                    'expand': function() {
                        Ext.Msg.alert("test","do you see me");// this alert never show, when the combo expanded
                        console.log(this.events.select);
                    }
        }
4

1 回答 1

0

我只是在事件处理逻辑执行后重置表单,如下所示:

            'select': function(combo, selection) {
                console.log('you there?');
                var building = selection[0];
                if (building) {

                    retrieveBuildingInfo(Ext.String.format(env_url + 'building.php?id={0}', building.get('id')));
                }
                this.reset();
            },

我不确定这是否是最好的方法,但它有效

于 2013-09-01T00:42:07.363 回答