jquery UI autocomplete menu retains the previous search values
I am using JQuery UI Autocomplete 1.8.2 in my application. If I do a search for an item and select an item, next time when I again type in the same search term, the autocomplete does not goes to the source URL to repopulate the search list but seems to be remembering the past search and just displaying them. This would be perfectly fine if I had the same search list always. But in my case, the search list can keep changing because of filter and other controls on the page. This results in chances of开发者_如何转开发 autocomplete bringing up a suggestion which is actually not part of the changed list. How can I clear up the menu items every time a search is to be made and basically override this remembering capability in autocomplete. This is my code:
$(function () {
$('#<%=Cntrl.ClientID %>').autocomplete({
minLength: 3,
delay: 500,
source: url + '&temp=' + new Date().getTime().toString(),
selectFirst:true,
select: function (event, ui) { ...}
});
});
Please help with suggestions on how to implement this.
I've never experienced this using autocomplete myself. Autocomplete doesn't do any caching (that I've experienced), however you may be find that your source is returning cached results.
精彩评论