PDA

View Full Version : How loose the focus by an Ext.form.ComboBox



anto75
10 Feb 2011, 1:13 AM
Hi all,
I need your help for a question apparently easy...

I have a gridPanel loaded by a PagingJSONStore. This GridPanel has a toolbar with one or more combobox linked to the same grid's store to filter they data. This gridPanel is refreshed automatically every tot seconds.

All works fine, BUT a little problem appears when the user select a value from a combo because it's opened on each refresh of data. This problem disappears if the user click out of the combo after the selection.

So, I'd like to force a blur of the focus on the combo after the selection, so I wrote some code as:



var combDefaultConfig = {
width: 130,
displayField:'name',
valueField:'value',
typeAhead: true,
triggerAction: 'all',
emptyText:'...',
//selectOnFocus:true,
selectOnFocus:false,
validateOnBlur: false,
mode: 'local'
};


var cb = new Ext.form.ComboBox(
Ext.apply(combDefaultConfig, {
store: s,
index: dataIndex,
listeners: {
'select': {
fn: function(combo, record, index) {
var field = combo.index;
var exp = record.get(combo.valueField);
this.onFilterSelect(field, exp);
//this.fireEvent('blur', this, this.lostFocus());
this.fireEvent('blur', this);

},
scope: this
}
}
})
);
And than in the parent of the combo I write a method on this event:


this.filterBar.on('blur', function() {
//this.focus();
//Ext.fly(this.getId()).dom.focus();
//Ext.get(this.getId()).focus();
//this.pagingBar.focus();
this.getView().focus();
}, this);BUT this doesn't solve my problem. The combobox is ever opened on the refreshdata . Someone has some helps? I need it!!

Thanks in advance,

Anto