jQuery 自动完成下拉框
经过近两天的搜索和研发,我终于得出了以下一些基于 jQuery 的自动完成插件,我发现它们值得并且适合我的网络应用程序。
我有一个基于 MVC2 的 Web 应用程序,正在使用 ASP.Net C# 开发。我将 L2S (LINQ to SQL) 作为我的 DAL,并使用服务层架构通过 L2S 获取数据。
现在,我要进行一些“查找” 其中选择列表可能 很大(即 1000 条或更多记录),所以 有时我想要自动完成的外观 最多是动态的(即我给页面 从中它将获得值和 显示在下拉菜单中)但是有 简单的也喜欢10-20个值 我想静态渲染。
简而言之,我需要一些简单且直接的自动完成插件,它可以完成这项工作,而不需要问我太多问题或需要太多 .js 文件(当然不包括 jQuery)。
这是我的研发总结以及我的结论 -
- 更简单,静态,包含搜索( http://frontensemble.com/hyjack/)
- 简单,静态/动态,仅从搜索开始(
http://bassistance.de/jquery-plugins/jquery-plugin-自动完成/)
- 复杂、静态/动态、组合框,例如包含搜索等等( http://jqueryui.com/demos/autocomplete/ http://docs.jquery.com/UI/Autocomplete/ )
- 更简单,静态/动态,包含搜索( http://www. dyve.net/jquery?自动完成 )
*请考虑上面的(点)作为我的评分。经过一些见解和演示评论后,我得出的结论是,我将使用#4 dyve.net 自动完成插件,因为它似乎可以完成我需要的一切,最重要的是它并不复杂。
你会发现#3 功能丰富,而且有更多功能,但它很大而且很复杂,所以我必须选择它。仅供参考,#2 只不过是 #3 的主要版本(但我面临的唯一问题是它(#2)只有开头匹配,包含匹配要好得多)
希望我走上正轨。
编辑:
经过一晚的外出之后 20个小时的奋斗和 实验。我的结论是 jQuery 我需要选择一些东西 哪个有更大的支持。和 选项#4 - 主要问题来了 当我想根据父项填充子项下拉列表时 它确实会动态填充,但它也会保留旧项目,因此在搜索时 - 旧项目会弹出! 我尝试了它的cacheFlush等,但没有成功。最后,我在作者的 google 代码页上发表了我的评论并留下了它。
- 我的最终选择是使用 jQueryui - 我可以做一些 当我得到太多时变得复杂 共享相同内容的其他插件 图书馆。所以,我投票给选项 #3
After almost two days of searching and R&D finally I've derived some of the following jQuery based auto-complete plugins which I find worth and suitable for my web-app.
I've an MVC2 based web-app that I'm developing in ASP.Net C#. I've L2S (LINQ to SQL) as my DAL and I use service layer architecture to fetch data via the L2S.
Now, I'm going to have some "Look ups"
in which the list of selection might
be big (i.e. 1000 or more records) so
at times I want my auto-complete look
up to be dynamic (i.e. I give the page
from which it'll get the values and
show in the dropdown) But there're
simple ones also like 10-20 values
which I want to render statically.
In short I need something v.simple and straight forward auto-complete plugin which does the job without asking me too many questions or requiring too many .js files (of course excluding jQuery).
Here's the summary of my R&D along with my conclusion -
- Simpler, static, has contains search(
http://frontensemble.com/hyjack/)
- Simple, static/dynamic, only starts with search(
http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/)
- Complex, static/dynamic, combobox like contains search and much more (
http://jqueryui.com/demos/autocomplete/
http://docs.jquery.com/UI/Autocomplete/
)
- Simpler, static/dynamic, has contains search (
http://www.dyve.net/jquery?autocomplete
)
*Pls consider the (dot) above as my ratings. After some insights and demo reviews I've concluded that I'll go with #4 the dyve.net auto-complete plugin because it seems to be doing everything I need and most importantly its not complex.
You'll find that #3 is rich in functionality and has much more but its big and gets complex so I've to opt it. FYI, #2 is nothing more but the primary version of #3 (but the only problem I faced is that it (#2) only has starts-with match, contains match is much better)
Hope I'm on track.
EDIT:
Well after a night-out and more then
20 hours of struggling and
experimenting. I conclude that with
jQuery I need to choose something
which has a bigger support. With
option #4 -The main problem came in
when I wanted to populate a child dropdown based on parent
It does populate dynamically but it persists the old items as well so while searching - the old ones will popup!
I tried its cacheFlush, etc.. but it didn't worked. Finally, I posted my comment on the author's google code page and left it.
- My final take would be to use
jQueryui - well I can do with some
complexity when I'm getting too many
other plugins who share the same
library. So, my vote goes to option
#3
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经接受了这样一个事实:它不会缓存任何搜索结果,并且会在用户键入时对每个术语执行基于 AJAX 的搜索。
我将包含 jQuery min 文件,而不是包含一堆捆绑时大小大致相同的 diff 文件。最好下载单个文件,而不是下载多个块,尤其是当一个文件小到 jquery min 时。
在某些情况下可能更适合的其他参考:
I've settled with the fact that it doesn't cache any search results and that it'll perform an AJAX based search upon each term as the user types.
I'll include the jQuery min file instead of including a bunch of diff files which size about the same when bundled. It is better to have a single file download rather then multiple chunks esp when that one file is as small as jquery min.
Other ref which might be preferable in certain situations: