PDA

View Full Version : Select/Highlight the first record after search in Combobox.



jvasanth
7 Aug 2013, 10:00 AM
Hi,

I have a following code to do a remote search and show the result. The template is used to format the result. I use EXT Js 3.2. When I do a search for "xyz" first time it does not elects/highlights the first record. When I use the same search condition "xyz" again it now brings up the result and selects/highlights the first record so that we can do a enter to select the record,
If I uncomment the piece of code that does a delete on the query (delete qe.combo.lastQuery;) then every time i do a search even if i do the same text say "xyz" 2 times it does not do a highlight of the first record.

I have tried several options to highlight the first record after doing search so that user can enter to select it, None of the options works. Am I missing something pretty simple?

Thanks for your help.

Code Snippet.

this.dataStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: '../Proxy/getData.asp?data=' + actionName
,method: "GET"
})
,reader: new Ext.data.JsonReader({
id: 'Key'
,root: actionName + '.Body.List'
,totalProperty: actionName + '.Body.Total'
}, [
{name: 'Key'}
,{name: 'Key1'}
,{name: 'Number'}
,{name: 'Vendor'}
])
,remoteSort: true
});


this.searcher = new Ext.form.ComboBox({
store: this.dataStore
,width: 165
,mode: 'remote'
,valueField: 'PoKey'
,typeAhead: false
,queryParam: 'SearchValue'
,loadingText: 'Searching'
,listEmptyText: 'No Results Found'
,hideTrigger: true
,forceSelection: true
,disabled: false
,minChars: 1
,maxHeight: 205
,listWidth: 300
,lazyInit: false
,inputType: 'text'
,tpl: tpl
// ,listeners: {
// beforequery: function(qe){
// delete qe.combo.lastQuery;
// }
// }
});

this.searcher.on('select', this.onPoSelection, this);

mitchellsimoens
11 Aug 2013, 4:18 PM
Moved to the Ext JS 3 help forum from Ext JS 4 Q&A forum.