-
2 Sep 2012 10:45 AM #1
Answered: Combobox autocomplete to search the whole string in local mode
Answered: Combobox autocomplete to search the whole string in local mode
Hello,
I have a combobox in local mode with a list of names that could be either (FirstName LastName) or (LastName FirstName). I noticed that the autocomplete only searches strings that start with "string" instead of contains "string". Kind of '%string%' instead of 'string%' in mysql. Is there a way to do this in a local mode ?
-
Best Answer Posted by vietits
Try this:
Code:Ext.onReady(function(){ var combo = Ext.create('Ext.form.field.ComboBox', { fieldLabel: 'Demo', renderTo: Ext.getBody(), multiSelect: false, displayField: 'name', width: 220, labelWidth: 70, store: { fields: ['name'], data: [{ name: 'John Smith' },{ name: 'Albert Einstein' },{ name: 'Thomas Edison' },{ name: 'John Deer' }] }, queryMode: 'local', listeners: { beforequery: function(qe){ qe.query = new RegExp(qe.query, 'i'); qe.forceAll = true; } } }); });
-
2 Sep 2012 6:13 PM #2
Try this:
Code:Ext.onReady(function(){ var combo = Ext.create('Ext.form.field.ComboBox', { fieldLabel: 'Demo', renderTo: Ext.getBody(), multiSelect: false, displayField: 'name', width: 220, labelWidth: 70, store: { fields: ['name'], data: [{ name: 'John Smith' },{ name: 'Albert Einstein' },{ name: 'Thomas Edison' },{ name: 'John Deer' }] }, queryMode: 'local', listeners: { beforequery: function(qe){ qe.query = new RegExp(qe.query, 'i'); qe.forceAll = true; } } }); });
-
2 Sep 2012 9:46 PM #3
This worked like a charm!!!
Thank you so much


Reply With Quote