-
6 Feb 2011 9:19 AM #1
ComboBox autocomplete: excluding some characters from triggering remote search
ComboBox autocomplete: excluding some characters from triggering remote search
Hello!
I have a combobox with autocomplete function turned on to query against a remote URL.
It works just fine, and I use it to let the user select from a list of TAGS (yes, like those used in blogs).
I would like to have some characters excluded from triggering a remote search.
For example, if I type "av", the remote search should be triggered.
Then say I select the word "aviation" from the list.
Then if I type a single comma "," after aviation because I want to enter a new word, the remote search should not be triggered.
That is, typing just a single comma or a single whitespace should not trigger any search.
Still I want to trigger the search when I type even one single alphabetic character.
Is that possible?
This is my code:
I tried with maskRe but looks like it's the wrong way.Code:var search = new Ext.form.ComboBox({ store: store, displayField:'name', typeAhead: false, minChars: 1, loadingText: 'Searching...', width: 570, pageSize:0, hideTrigger:true, tpl: resultTpl, applyTo: 'search', itemSelector: 'div.search-item' });
Thank you!
-
6 Feb 2011 9:43 AM #2
Guess I found the way

Anyway, any better idea is welcome of course
Code:listeners: { 'beforequery': function (queryEvent) { value = queryEvent.combo.getValue(); re = /.*[,\s]+$/; if (value.match(re)) { return false; } else { return true; } } }
Similar Threads
-
Combobox typeAhead/autocomplete for mode:'remote'
By outrage in forum Ext 2.x: Help & DiscussionReplies: 6Last Post: 24 Jun 2011, 6:57 AM -
Autocomplete and remote combobox issue
By douggiefox in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 10 Mar 2010, 7:30 AM -
Remote populated ComboBox autoComplete: what's better solution
By slimarafa in forum Ext GWT: Help & Discussion (1.x)Replies: 0Last Post: 16 Mar 2009, 7:06 AM -
Autocomplete on remote combobox?
By mtrpcic in forum Ext 2.x: Help & DiscussionReplies: 6Last Post: 16 Jan 2008, 12:46 PM


Reply With Quote