PDA

View Full Version : KeyUp and Timeout



myput
17 Oct 2011, 12:06 AM
Hello,

i have a problem in my search form.
When in my Keyup i click on enter, it's ok, the form give me the results. But i would like, when i click on an another touch, send the data of the searchfield to get the jform, like autocompletion.

For that, i would like, with a timeout, send all the for exemple 20000 ms, send the data of searchfield and request the JSON.

for the moment, i have:


listeners: {
keyup: function(thisField, e) {
if (e.browserEvent.keyCode == 13) {
var query = Ext.getCmp("textquery").getValue();
if (query == "") {
alert("Empty");
}
else {
Ext.Ajax.request ({
url: WPApp.config.host + WPApp.config.PhpPath + 'searchModule.php?search=' + query,
success: function (e) {
var obj = Ext.util.JSON.decode(e.responseText);
var html = WPApp.views.SearchPanelTemplate.apply(e.responseText);
WPApp.views.ResultPanel.update(obj);
}
});
}
}
else {


}
}
}


In else, i would like to get the touch data, in a give time... it's possible ?
How i can do please?