PDA

View Full Version : ComboBox search on individual string components



Mahendru
8 Oct 2010, 7:15 AM
Hi,

I have a ComboBox with it's mode set to local. I have a set of hard-coded values in a store that are retrieved by the ComboBox. My problem is that the search seems to work only for the entire string, from left to right, and not parts of it. For example, if one my values is 'The cat and the rat caught a big bat,' I only get this string back if I start typing 'The cat and . . . .' But not if I type just 'cat,' 'rat,' 'big' etc. Please help. Here's the code I have so far:


new Ext.form.ComboBox ({

hideTrigger: true
,hideLabel: true
,triggerAction: 'all'
,typeAhead: true
,width: 275
,mode: 'local'
,displayField: 'label'
,valueField: 'label'
,style: 'align:center'
,labelStyle: 'width:5'
,store: new Ext.data.ArrayStore(

{
fields: ['label']
,data: [['Random String Value 1'],['Random String Value 2']]
}
)
})

Thanks,
Jay

Foster
8 Oct 2010, 7:29 AM
have you tried playing around with the beforequery event? It may work to add a listener to this event, and then overwrite the queryEvent.query string. You should be able to add a regular expression or wildcard. This should work for local stores.

Condor
8 Oct 2010, 7:31 AM
You should read this (http://www.sencha.com/forum/showthread.php?53232-Combobox-remove-space-during-search&p=253708#post253708) (which inspired this (http://www.sencha.com/forum/showthread.php?60878-OPEN-58-ComboBox-to-allow-custom-Store-filtering-on-local-query) feature request).

Mahendru
8 Oct 2010, 7:52 AM
You should read this (http://www.sencha.com/forum/showthread.php?53232-Combobox-remove-space-during-search&p=253708#post253708) (which inspired this (http://www.sencha.com/forum/showthread.php?60878-OPEN-58-ComboBox-to-allow-custom-Store-filtering-on-local-query) feature request).

Thanks Condor! Works like a charm. Also, thank you Foster.