jQueryUI:自动完成大数据是悬挂浏览器 [英] jQueryUI: Autocomplete with large data is hanging browser

查看:73
本文介绍了jQueryUI:自动完成大数据是悬挂浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中使用 jQueryUI的自动完成。我有一个自动完成文本,其中用户搜索的东西和相应的数据下拉。

I am using jQueryUI's autcomplete in my project. I have a autocomplete text where user search something and corresponding data comes in drop down.

使用小数据集,它工作正常。当数据集很大时会出现问题。我有几乎1L记录具有唯一值,我作为源附加到 autocomplete

With a small data set, it's working fine. The problem arises when the data set is large. I have almost 1L records with unique values which I've attach as source to autocomplete.

现在,一旦用户在文本栏中输入搜索字符串,浏览器就会因为处理 autocomplete 而挂起原因jQueryUI的确如此。

Now as soon as user enter search string in the text bar the browser hangs cause because of the processing that autocomplete of jQueryUI does.

我想知道如何优化它或使其更快,以便borwser不会挂起。这是我创建的 plunkr 。这就是我要将源附加到自动完成的过程。

I want to know how can I optimize it or make it faster so that the borwser does not hang. Here's the plunkr I have created to play. And this is what I am doing to attach source to autocomplete.

$("#tags").autocomplete({
      source: availableTags
});


推荐答案

添加显示结果的限制,例如十。

Add a limit of displayed results, like ten.

这篇关于jQueryUI:自动完成大数据是悬挂浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆