I have a ComboBox working correctly using an XML Reader. But the type ahead does not seem to work correctly. Whatever I type in the text box, the first element that is returned is always selected. Any ideas ?
Code:
/*
* Ext JS Library 2.1
* Copyright(c) 2006-2008, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
Ext.onReady(function(){
var ds = new Ext.data.Store({
url: 'getData.do',
reader: new Ext.data.XmlReader({
record: 'item'
}, [
{name: 'record', mapping: 'RECORD'}
])
});
// Custom rendering Template
var resultTpl = new Ext.XTemplate(
'<tpl for="."><div class="search-item">',
'<h3>{record}</h3>',
'</div></tpl>'
);
var search = new Ext.form.ComboBox({
store: ds,
displayField:'record',
typeAhead: true,
typeAheadDelay: 100,
selectOnFocus: true,
minChars: 2,
loadingText: 'Searching...',
width: 570,
pageSize:10,
hideTrigger:true,
tpl: resultTpl,
applyTo: 'search'
}
});
});
<result>
<item><RECORD>ABC-DEF</RECORD></item>
<item><RECORD>ABB-DEF</RECORD></item>
<item><RECORD>BBC-DEG</RECORD></item>
<item><RECORD>BBD-EFG</RECORD></item>
</result>