[ADD] automatic selection of first completion item in the list

bzr revid: xmo@openerp.com-20120502150808-jpqiq63574ds2c1g
This commit is contained in:
Xavier Morel
2012-05-02 17:08:08 +02:00
parent f009c76598
commit dce41d8aea
+9
View File
@@ -286,6 +286,15 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
this.$element.on('blur', function () {
self.$element.removeClass('oe_focused');
});
// when the completion list opens/refreshes, automatically select the
// first completion item so if the user just hits [RETURN] or [TAB] it
// automatically selects it
this.$element.on('autocompleteopen', function () {
var menu = self.$element.data('autocomplete').menu;
menu.activate(
$.Event({ type: "mouseenter" }),
menu.element.children().first());
});
return $.when(p, this.ready);
},