mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[ADD] search only a few milliseconds after a keypress
This commit is contained in:
@@ -84,6 +84,7 @@ openerp.web_search_autocomplete_prefetch = function(instance)
|
||||
});
|
||||
|
||||
instance.web.search.AutoComplete.include({
|
||||
keypress_timeout: 200,
|
||||
select_item: function()
|
||||
{
|
||||
if(!this.current_result)
|
||||
@@ -92,5 +93,18 @@ openerp.web_search_autocomplete_prefetch = function(instance)
|
||||
}
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
initiate_search: function(query)
|
||||
{
|
||||
var self = this,
|
||||
_super = this._super,
|
||||
last_timeout = null;
|
||||
this.last_timeout = last_timeout = window.setTimeout(function()
|
||||
{
|
||||
if(self.last_timeout == last_timeout)
|
||||
{
|
||||
_super.apply(self, [query]);
|
||||
}
|
||||
}, this.keypress_timeout)
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user