PDA

View Full Version : Combo box autosuggest



life.raghav
22 May 2010, 4:22 AM
I am using combobox autosuggest which displays results on pressing enter button. But when i enter some other value which is not present in the autosuggest list i am not able to retrieve the correct results. In this case the results get displayed even before i finish typing in the combobox and press enter. Could anyone help me in finding the solution for the same. The code which i use is as follows


var newform = new Ext.form.FormPanel({
renderTo: 'oldform',
border: false,
items: [{
html: 'Test',
border: false
},
{
name: 'From',
xtype: 'combo',
width: 172,
listWidth: 220,
hideLabel: true,
labelStyle: 'padding:4px;',
store: remotestore,
id: 'suggest',
displayField: 'NAME',
forceSelection: false,
lazyRender: true,
pageSize: 15,
minChars: 1,
mode: 'remote',
emptyText: 'Enter min 1 char...',
enableKeyEvents: true,
hideTrigger: true,
autoSelect: false,
listener: {
specialkey: function (field, el) {
if (el.getKey() == Ext.EventObject.ENTER) {
autosearch();
}
}
}
}]
});

Condor
22 May 2010, 5:24 AM
Are you saying it fires a 'enter' specialkey event even though you didn't press enter?

ps. In autosearch() you should probably use combo.getRawValue() to get the typed text.

life.raghav
25 May 2010, 6:58 AM
yes i used combo.getRawValue() to retrieve the result. Is that the mistake? Is there any other way to get the result?

Condor
25 May 2010, 9:46 PM
No, that's correct.

Can you describe a little better what the problem is?