jquery UI 自动完成菜单保留以前的搜索值
我在我的应用程序中使用 JQuery UI Autocomplete 1.8.2。如果我搜索一个项目并选择一个项目,下次当我再次输入相同的搜索词时,自动完成功能不会转到源 URL 重新填充搜索列表,但似乎会记住过去的搜索并仅显示他们。 如果我总是有相同的搜索列表,那就太好了。但就我而言,由于页面上的过滤器和其他控件,搜索列表可能会不断变化。这会导致自动完成功能提出实际上不属于已更改列表的建议。 如何在每次进行搜索时清除菜单项,并基本上覆盖自动完成中的这种记忆功能。 这是我的代码:
$(function () {
$('#<%=Cntrl.ClientID %>').autocomplete({
minLength: 3,
delay: 500,
source: url + '&temp=' + new Date().getTime().toString(),
selectFirst:true,
select: function (event, ui) { ...}
});
});
请提供有关如何实现此代码的建议。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我自己从未使用自动完成功能经历过这种情况。
自动完成不会进行任何缓存(我已经经历过),但是您可能会发现您的源正在返回缓存的结果。
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.