【问题标题】:Bootstrap3 typeahead limitBootstrap3 预输入限制
【发布时间】:2017-06-06 18:43:40
【问题描述】:

我正在使用 bootstrap3 typeahead,但在某些情况下,我的 API 返回了很多结果(大约 40 个),但 typeahead 只弹出 8 个结果。

我试图解决这个问题

limit: 30

但是没有用。

如何更改它以显示超过 8 个结果?

顺便说一句,我的输入是

$('#postcode').typeahead({
  source: function (query, process) {
    var ajaxResponse;
    $.ajax({
      url: "my_url",
      type: "GET",
      cache: false,
      success : function (response) {
        process(response.addresses);
      }
    });
  },
  limit: 30,
  minLength: 2,
  displayText: function(item) {
    return item.full_description;
  },
  updater: function(item) {
    // some func here
    return item;
  }
});

【问题讨论】:

    标签: twitter-bootstrap-3 bootstrap-typeahead


    【解决方案1】:

    您要寻找的不是“限制”,而是“项目”。改变它,它就会起作用。

    您可以指定特定数量的项目,也可以指定“全部”。

    【讨论】:

    • 您可能希望通过显示更正的代码来改进您的答案。官方文档的链接也有助于支持您的声明。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-09-22
    • 2014-03-01
    • 2015-01-31
    • 2016-09-26
    • 2014-12-24
    • 2013-03-09
    • 1970-01-01
    相关资源
    最近更新 更多