[FIX] trigger search and correctly position cursor after adding a facet through completion

bzr revid: xmo@openerp.com-20120321164213-o1dgm4dihtrb45bt
This commit is contained in:
Xavier Morel 2012-03-21 17:42:13 +01:00
parent 60c07691f1
commit 9415f59853
1 changed files with 4 additions and 1 deletions

View File

@ -43,10 +43,12 @@ if (SearchBox_renderSearchInput.toString() !== VS.ui.SearchBox.prototype.renderS
var SearchBox_searchEvent = function (e) {
var query = this.value();
this.renderFacets();
this.focusSearch(e);
this.app.options.callbacks.search(query, this.app.searchQuery);
};
if (SearchBox_searchEvent.toString() !== VS.ui.SearchBox.prototype.searchEvent.toString().replace(
/this\.focusSearch\(e\);\n[ ]{4}this\.value\(query\)/, 'this.renderFacets()')) {
/this\.focusSearch\(e\);\n[ ]{4}this\.value\(query\)/,
'this\.renderFacets();\n this\.focusSearch(e)')) {
throw new Error(
"Trying to replace wrong version of VS.ui.SearchBox#searchEvent. "
+ "Please fix replacement.");
@ -200,6 +202,7 @@ openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.Search
e.preventDefault();
this.vs.searchQuery.add(new VS.model.SearchFacet(_.extend(
{app: this.vs}, ui.item)));
this.vs.searchBox.searchEvent({});
},
/**