Fixed that autocomplete results are not reset after clearing search field (#11909).

Contributed by Jongwook Choi.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10527 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-09-29 16:43:11 +00:00
parent 81782f2408
commit 8cf8f5bdbf
1 changed files with 8 additions and 10 deletions

View File

@ -496,16 +496,14 @@ function observeSearchfield(fieldId, targetId, url) {
var val = $this.val(); var val = $this.val();
if ($this.attr('data-value-was') != val){ if ($this.attr('data-value-was') != val){
$this.attr('data-value-was', val); $this.attr('data-value-was', val);
if (val != '') { $.ajax({
$.ajax({ url: url,
url: url, type: 'get',
type: 'get', data: {q: $this.val()},
data: {q: $this.val()}, success: function(data){ $('#'+targetId).html(data); },
success: function(data){ $('#'+targetId).html(data); }, beforeSend: function(){ $this.addClass('ajax-loading'); },
beforeSend: function(){ $this.addClass('ajax-loading'); }, complete: function(){ $this.removeClass('ajax-loading'); }
complete: function(){ $this.removeClass('ajax-loading'); } });
});
}
} }
}; };
var reset = function() { var reset = function() {