user1913742
user1913742

Reputation: 151

Avoid expanding combo box on 'focus' or 'onclick' event

Team,

I am having one problem where I donot want to expand combo box on certain flag and want to display the alert message.

there is no event like onClick in EXTJS so I tried with focus event but still combo box is expanding.

code

focus:function() {
    if(this.store.baseParams.donotExpandFlag) {
           alert("I should not expand this combo");
           // What to do here and out side of IF block so that there is conditional expansion          
    }              
}

Upvotes: 0

Views: 2586

Answers (1)

sra
sra

Reputation: 23983

You need to specifiy your ExtJS version and please format your code.

Here is what you can do for ExtJS4.x

Manually set/unset the isExpanded property. That should work (untested)

for ExtJS3.x you will have to override the the isExpanded() method and in additon apply a custom flag which indicates blocked/auto and get checked before the default code gets executed.

You may try this (untested)

_isExpanded:  true, // true means block, false auto
isExpanded: function(){
    return this._isExpanded || (this.list && this.list.isVisible());
},

No, this works. See the JSFiddle for ExtJS3.4

Second JSFiddle for ExtJS3.4 with a form

Upvotes: 2

Related Questions