如何通过 Oracle ApEx 使用具有多个值的 jQuery UI 自动完成?

发布于 2024-11-07 02:54:56 字数 904 浏览 1 评论 0原文

我正在使用 Oracle Application Express (ApEx v3.0.1),并且我想使用 jQuery UI – 具有多个值的自动完成示例。

请参阅: http://jqueryui.com/demos/autocomplete/#multiple

基本上,寻找在本示例的源代码中,它具有以下变量数据集:

        var availableTags = [
        "ActionScript",
        "AppleScript",
        "Asp",
        "BASIC",
        "C",
        "C++",
        "Clojure",
        "COBOL",
        "ColdFusion",
        "Erlang",
        "Fortran",
        "Groovy",
        "Haskell",
        "Java",
        "JavaScript",
        "Lisp",
        "Perl",
        "PHP",
        "Python",
        "Ruby",
        "Scala",
        "Scheme"
    ];

我想要做但不确定如何使用 Oracle ApEx 是通过按需流程引用数据库表并检索我希望用户访问的客户名称从中选择多个值,甚至只选择一个值。

但唯一的问题是,该表有超过 90,000 条记录,因此不确定执行此操作的最佳方法是什么。

几乎,我想像 Stack Overflow 在为问题选择标签时那样做。

I am using Oracle Application Express (ApEx v3.0.1) and I would like to use jQuery UI – Autocomplete with Multiple values example.

See: http://jqueryui.com/demos/autocomplete/#multiple

Basically, looking at the source for this example, it has the following variable dataset:

        var availableTags = [
        "ActionScript",
        "AppleScript",
        "Asp",
        "BASIC",
        "C",
        "C++",
        "Clojure",
        "COBOL",
        "ColdFusion",
        "Erlang",
        "Fortran",
        "Groovy",
        "Haskell",
        "Java",
        "JavaScript",
        "Lisp",
        "Perl",
        "PHP",
        "Python",
        "Ruby",
        "Scala",
        "Scheme"
    ];

What I would like to do and unsure how to do with Oracle ApEx is reference a database table via an on-demand process and retrieve customer names where I would like a user to select multiple values from or even just a single value.

The only issue too though is, this table has over 90,000 records and so not sure what the best way to do this.

Pretty much, I would like to do it like Stack Overflow does it when choosing the tags for a question.

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

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

发布评论

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

评论(1

—━☆沉默づ 2024-11-14 02:54:56

您可以将函数作为 source 选项 传递:

$(stuff).autocomplete({
    source: function(request, response) {
      $.ajax({
          url: '/your/autocompleter?pat=' + encodeURIComponent(request.term),
          type: 'get',
          success: function(data) {
              response(data.split('\n'));
          },
          // Other AJAX options as needed
      }),
      // Other autocomplete options as needed
});

然后、/your/autocompleter 将获取他们当前在 pat 参数中输入的内容,并使用它来查询数据库以查找可能的匹配项。要将可能的匹配项返回给自动完成程序,您只需将可能的匹配项作为字符串列表返回(每行一个匹配项),内容类型为 text/plain。您不需要使用“每行一个”纯文本格式,但这可能是最简单的,您只需要确保成功回调可以将 /your/autocompleter 返回数据解析为数组交给响应

You can pass a function as the source option:

$(stuff).autocomplete({
    source: function(request, response) {
      $.ajax({
          url: '/your/autocompleter?pat=' + encodeURIComponent(request.term),
          type: 'get',
          success: function(data) {
              response(data.split('\n'));
          },
          // Other AJAX options as needed
      }),
      // Other autocomplete options as needed
});

Then, /your/autocompleter would get what they've currently entered in the pat parameter and use that to query your database to find possible matches. To get the possible matches back to the autocompleter, you'd just have to return the possible matches as a list of strings — one match per line — with a content type of text/plain. You don't need to use the "one per line" plain text format but that's probably the easiest, you only need to ensure that the success callback can parse the /your/autocompleter return data into an array to hand to response.

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