click事件的面板项侦听器仅触发一次

时间:2013-08-31 22:55:50

标签: extjs

select侦听器只触发一次。然后返回并附加属性 射击:假 在第二次点击。我怎样才能防止这种情况发生?

这是一个例子: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);
                    }
        }

1 个答案:

答案 0 :(得分:0)

我只是在事件处理逻辑执行likeo后重置表单:

            '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();
            },

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