PDA

View Full Version : Search as you type feature



ravitejak
13 Apr 2012, 3:36 AM
Hey all,
I have a requirement to implement search as you type feature in my project. Is there a baked code in EXT to do that ? Remember, I will have atleast >1 lac records with me .

Suggestions will help me a lot.

:)

tvanzoelen
13 Apr 2012, 3:37 AM
You could look into the combobox queryType: 'remote'

http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.field.ComboBox

ravitejak
13 Apr 2012, 3:59 AM
But i would like it in a text box instead of combo... Hw should i proceed now ?

tvanzoelen
13 Apr 2012, 4:08 AM
You could use a textfield as well. Put a keylistener on it. I suppose with delayedtask as well, see
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.util.DelayedTask

in that task you send an Ajax request. See http://docs.sencha.com/ext-js/4-0/#!/api/Ext.Ajax

while the Ajax request is in progress you disable the keypress event. event.stopEvent. Until it returns and you update the textfieldvalue

droessner
13 Apr 2012, 4:38 AM
You should use a combo box with queryType: 'remote' just like tvanzoelen suggested initially. You can then specify hideTrigger: true on the combo box to have it look like a textbox.