fangzhouxing
27 Jul 2007, 6:38 PM
The auto complete function of comboBox is achieved by search the value of displayField, but I want to search another field(see the attached pic).
Can anyone help? Thanks in advance.
fangzhouxing
28 Jul 2007, 1:32 AM
The problem was solved by myself.
//New ComboBox with 'searchField' config options:
Divo.ComboBox = function(config){
Divo.ComboBox.superclass.constructor.call(this, config);
};
Ext.extend(Divo.ComboBox, Ext.form.ComboBox, {
searchField: undefined
//override
,doQuery : function(q, forceAll){
if(q === undefined || q === null){
q = '';
}
var qe = {
query: q,
forceAll: forceAll,
combo: this,
cancel:false
};
if(this.fireEvent('beforequery', qe)===false || qe.cancel){
return false;
}
q = qe.query;
forceAll = qe.forceAll;
if(forceAll === true || (q.length >= this.minChars)){
if(this.lastQuery != q){
this.lastQuery = q;
if(this.mode == 'local'){
this.selectedIndex = -1;
if(forceAll){
this.store.clearFilter();
}else{
this.store.filter(this.searchField, q); //only modify this line
}
this.onLoad();
}else{
this.store.baseParams[this.queryParam] = q;
this.store.load({
params: this.getParams(q)
});
this.expand();
}
}else{
this.selectedIndex = -1;
this.onLoad();
}
}
},
});
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.