PDA

View Full Version : Matching type characters in the Combo Box issue......



sankarbaluz
15 Nov 2011, 6:18 AM
Hi,
In my combo box,with out setting "forceSelection:true",I need to check the typing characters would match with the server.I mean to say,If the user is typing fast some characters in combobox,it should check with the server and return a response.

The following is the code which I am using.Please provide me a better solution for this.


var cmpVIA = {
xtype:'pnccombobox',
store: dsVIA,
forceSelection:false,
allowBlank:false,
id:'cmbVIA',
displayField:'viaNo',
valueField:'intViaNo',
fieldLabel:'VIA',
width:160,
labelWidth:40,
matchFieldWidth:false,
typeAhead: true,
triggerAction: 'all',
selectOnFocus:true,
listConfig: {
width:250,
loadingText: 'Loading...',
height:100,
deferEmptyText:false,
emptyText:'No Values Found!',
getInnerTpl: function() {
return '<table><tr><td colspan="2" height="5"></td></tr><tr valign="top"><td width="125px" align="left">{viaNo}</td><td width="125px" align="left">{vslNm}</td></tr><tr><td height="2"></td></tr><tr valign="top"><td align="left">{etaDttm}</td><td align="left">{etdDttm}</td></tr><tr><td height="2"></td></tr><tr valign="top"><td align="left">{dschVoyNo}</td><td align="left">{ldVoyNo}</td></tr><tr><td colspan="2" height="5"></td></tr></table>';
}
},
listeners:{
select:function(combo,record){
var index = combo.store.find('intViaNo', combo.getValue());
var setVesselTime = combo.store.data.items[index].data.etaDttm;
intViaNumber = combo.store.data.items[index].data.intViaNo;
Ext.getCmp('idDateField').setValue(setVesselTime);
Ext.getCmp('viaCnsrtmCdId').setValue(record[0].data.cnsrtmCd);
categorySelectedId = this.getValue();
}

}
};

mitchellsimoens
16 Nov 2011, 1:02 PM
This is the configs I use on one of my combos that does remote filtering:


fieldLabel : 'Users',
displayField : 'username',
valueField : 'userid',
forceSelection : true,
queryParam : 'search',
multiSelect : true,
triggerAction : 'query',
emptyText : 'Type a username to search',
name : 'userids',

sankarbaluz
18 Nov 2011, 12:53 AM
Hi Mitchellsimoens,
Thank you for the reply...But I specified in the forum that i need forceSelection:"false".I tried some code for clearing that.But its not the right way to do...Below is the code which Im using.Please give me a right solution for this.



var cmpVIA = {
xtype:'pnccombobox',
store: dsVIA,
allowBlank:false,
id:'cmbVIA',
displayField:'viaNo',
valueField:'intViaNo',
fieldLabel:'VIA',
width:160,
labelWidth:40,
matchFieldWidth:false,
typeAhead: true,
triggerAction: 'all',
selectOnFocus:true,
listConfig: {
width:250,
loadingText: 'Loading...',
height:100,
deferEmptyText:false,
emptyText:'No Values Found!',
getInnerTpl: function() {
return '<table><tr><td colspan="2" height="5"></td></tr><tr valign="top"><td width="125px" align="left">{viaNo}</td><td width="125px" align="left">{vslNm}</td></tr><tr><td height="2"></td></tr><tr valign="top"><td align="left">{etaDttm}</td><td align="left">{etdDttm}</td></tr><tr><td height="2"></td></tr><tr valign="top"><td align="left">{dschVoyNo}</td><td align="left">{ldVoyNo}</td></tr><tr><td colspan="2" height="5"></td></tr></table>';
}
},
listeners:{
select:function(combo,record){
var index = combo.store.find('intViaNo', combo.getValue());
var setVesselTime = combo.store.data.items[index].data.etaDttm;
intViaNumber = combo.store.data.items[index].data.intViaNo;
Ext.getCmp('idDateField').setValue(record[0].data.etaDttm);
Ext.getCmp('viaCnsrtmCdId').setValue(record[0].data.cnsrtmCd);
categorySelectedId = this.getValue();
},
blur:function(){
var obj = new Object();
obj.combo = this;
obj.keyVal = 'intViaNo';
obj.dependents = [{id:'idDateField', dataIndexProp:'etaDttm'},{id:'viaCnsrtmCdId', dataIndexProp:'cnsrtmCd'}];
obj.url = 'EntityLookup/validateVoyage';
obj.params = {viaNo:this.getRawValue()};
comboBlurEventValidateVal(obj);
if(this.getRawValue()!=this.getOldRawValue() && this.getFieldValid==true){
categorySelectedId = this.getValue();
}
}
}
};


Thanks,
Sankar