YUI3 自动完成

发布于 2024-08-21 20:30:52 字数 224 浏览 4 评论 0原文

我想我想从 Scriptaculous 切换到 YUI。因此,我想做的第一件事是在我的应用程序演示的首页上添加自动完成功能。我为此所做的每一次搜索都会向我推荐 YUI2 示例和说明。它们使用 YAHOO 对象而不是 YUI 对象,我只是不相信这是正确的方法。

如果我已经熟悉 2.x,可能不会太难,但我来自一组不同的库。有谁知道如何使用 YUI 3 实现自动完成功能吗?任何帮助将不胜感激。

谢谢,戴夫

I think I would like to make the switch from Scriptaculous to YUI. So, the first thing I am trying to do is an autocomplete feature on the front page of my application demo. Every single search I do for this, refers me to YUI2 examples and instructions. These use YAHOO objects instead of YUI objects, and I just don't trust that this is the right way to do it.

If I was already familiar with 2.x, it may not be too hard, but I'm coming from a different set of libraries. Does anyone have instructions how to implement an autocomplete feature using YUI 3? Any help would be appreciated.

Thanks, Dave

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

与之呼应 2024-08-28 20:30:52

官方 YUI 3 AutoComplete 小部件在 YUI 3.3.0 中发布:http://developer.yahoo。 com/yui/3/自动完成/

The official YUI 3 AutoComplete widget was released in YUI 3.3.0: http://developer.yahoo.com/yui/3/autocomplete/

十六岁半 2024-08-28 20:30:52

YUI 3 中的自动完成功能已完成一些初步工作。由于资源问题,它暂时移至库中,以便实现者可以访问它,直到它完全充实、记录并为正式发布编写示例。

http://yuilibrary.com/gallery/show/autocomplete

Some initial work was done on AutoComplete in YUI 3. Due to resource issues, it was moved to the Gallery for the time being so implementers would have access to it until it is fully fleshed out, documented, and examples written for official release.

http://yuilibrary.com/gallery/show/autocomplete

揽清风入怀 2024-08-28 20:30:52

许多小部件尚未从 2.x 移植到 3.x。如果您确实反对使用 YUI 2.x,您可能可以自己移植该小部件; YUI 在 GitHub 上

A lot of the widgets haven't been ported from 2.x to 3.x yet. If you're really opposed to using YUI 2.x, you could probably port the widget yourself; YUI is on GitHub.

小嗷兮 2024-08-28 20:30:52

这是一个来自 Apache Roller 的示例,使用 Y.DataSource.IO 使用 JSON 检索数据(我还包括使用本地数组的测试行“ds2”,我已经从代码中删除了。)据我了解,如果您使用 JSONP,则应使用 Y.DataSource.Get。

此自动完成功能适用于人们用来为博客条目输入 0 个或多个标签(主题)的“标签”字段。它根据用户输入查询以前使用的其他博客条目的标签,作为对用户的建议(当用户输入更多字母“b..a...等时,出现的项目更少。)如果有助于理解示例,这里是返回的 JSON 示例:

{ "prefix": "ba",
  "weblog": "gmazza",
  "tagcounts": [
   { "tag" : "bahamas", "count" : 1 }, 
   { "tag" : "baltimore", "count" : 3 }, 
   { "tag" : "baseball", "count" : 3 }]
}

我的建议是首先使用本地硬编码数组作为源(上面示例中的我的 ds2)进行自动完成。完成后,然后专注于使数据源正常运行并正确进行自动完成从它而不是数组中读取。

Here's an example from Apache Roller using Y.DataSource.IO to retrieve data using JSON (I also include a testing line "ds2" using a local array, that I've since removed from the code.) As I understand, Y.DataSource.Get should be used instead if you're using JSONP.

This autocomplete is for the "tags" field that people use to type in 0 or more tags (topics) for a blog entry. It queries previously used tags for other blog entries as suggestions for the user, based on the user input (as the user types in more letters "b..a... etc., fewer items appear.) If helpful for understanding the sample, here's a sample of the JSON returned:

{ "prefix": "ba",
  "weblog": "gmazza",
  "tagcounts": [
   { "tag" : "bahamas", "count" : 1 }, 
   { "tag" : "baltimore", "count" : 3 }, 
   { "tag" : "baseball", "count" : 3 }]
}

My recommendation is to first get the autocomplete working with a local hardcoded array as the source (my ds2 in the example above.) Once done, then focus on getting the datasource operative and having the autocomplete correctly read from it instead of the array.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文