jqueryui 自动完成功能停止触发
我正在处理 jqueryui 自动完成 JSONP 示例: http://jqueryui.com/demos/ autocomplete/#remote-jsonp
即使在他们自己的演示中,我也设法使这个错误发生;不幸的是我无法一致重现它。
如果我开始在文本框中输入内容,它将自动完成。
如果我不选择结果,然后“模糊”控件(专注于其他内容),然后返回控件并再次开始输入,则自动完成“源”功能(有时)根本不会触发再也不会了,直到我刷新页面。 我通过将一些日志代码放入源函数中验证了这一点;该函数就停止被调用。 我无法确定它发生的确切情况。
这是一个已知的错误吗?下一个版本中可能会修复某些问题吗?
编辑:将以下陈述加粗,因为这是问题最重要的部分,以回应有人对原始内容投反对票:
有没有办法“重置”自动完成对象,以便在这种情况下它再次开始工作?我尝试在对象失去焦点时再次运行 $("#foo").autocomplete(...) ,但这没有帮助。
谢谢!
I am working off of the jqueryui autocomplete JSONP example here: http://jqueryui.com/demos/autocomplete/#remote-jsonp
Even in their own demo, I've managed to make this bug happen; unfortunately I can't consistently reproduce it.
If I start typing into the text box, it will autocomplete.
If I don't choose a result, and then "blur" the control (focus on something else), and then go back in to the control and start typing again, the autocomplete "source" function (sometimes) simply doesn't fire anymore, never again, until I refresh the page.
I have verified this by putting some logging code into the source function; the function just stops being called.
I can't identify the exact circumstance in which it happens.
Is this a known bug? Something maybe being fixed in the next release?
Edit: bolded the following statement because it's the meatiest part of the question, in response to someone downvoting the original:
Is there any way to "reset" the autocomplete object so that it starts working again in this case? I've tried running my $("#foo").autocomplete(...) again when the object loses focus, but that doesn't help.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以这样做:
如果你的源是 ajax 调用或方法,我建议将你的源值保存在变量中
You could do something like this:
if your source is a ajax call or method I would suggest saving your source value in a variable