Search and Top Navigation
#5619 closed bug (fixed)
Opened May 17, 2010 07:24AM UTC
Closed July 30, 2010 05:00PM UTC
Last modified November 19, 2010 06:26PM UTC
Autocomplete widget keeps looking for remote data even when it's disabled
Reported by: | ggp | Owned by: | |
---|---|---|---|
Priority: | critical | Milestone: | 1.8.3 |
Component: | ui.autocomplete | Version: | 1.8.2 |
Keywords: | autocomplete disable disabled remote | Cc: | |
Blocked by: | Blocking: |
Description
I think that autocomplete widget shouldn't send Ajax request to server looking for data when the option 'disabled' is true. I don't know if that's a bug or it's thought to work that way, but I think this isn't correct because server receives load even when you're not interested in its response.
If the source of autocomplete is a remote database with a lot of rows to fetch, this is critical. I want to search data only when clicking a 'search' button, and now it's impossible.
Attachments (0)
Change History (7)
Changed May 17, 2010 07:42AM UTC by comment:1
Changed May 17, 2010 08:13AM UTC by comment:2
an easier fix:
$('#my_input').autocomplete({
search: function(event, ui) {
if($(this).autocomplete('option', 'disabled') == true) {
return false;
}
}
});
Changed July 30, 2010 10:39AM UTC by comment:3
milestone: | TBD → 1.9 |
---|---|
priority: | major → critical |
version: | 1.8.1 → 1.8.2 |
The suggested solution is probably too specific. Autocomplete doesn't care for the disabled option at all, that needs to be fixed.
Changed July 30, 2010 10:40AM UTC by comment:4
component: | ui.core → ui.autocomplete |
---|
Changed July 30, 2010 05:00PM UTC by comment:5
resolution: | → fixed |
---|---|
status: | new → closed |
Fixed in 90caa93.
Changed August 04, 2010 01:18AM UTC by comment:6
milestone: | 1.9 → 1.8.3 |
---|
I propose to replace the current _search method with this:
if (this.options.disabled == false) {
always save the actual value, not the one passed as an argument
this.term = this.element.addClass( "ui-autocomplete-loading" ).val();
this.source( { term: value }, this.response );
}
To use it as a fix in current production environments I propose to use this code:
$.ui.autocomplete.prototype._search = function(value) {
if (this.options.disabled == false) {
always save the actual value, not the one passed as an argument
this.term = this.element.addClass( "ui-autocomplete-loading" ).val();
this.source( { term: value }, this.response );
}
}