【问题标题】:Bootstrap Typeahead - no results foundBootstrap Typeahead - 未找到任何结果
【发布时间】:2017-05-01 05:13:49
【问题描述】:

使用 TypeAhead 0.10.4,我想在查询未找到结果时显示不可选择的消息。我该怎么做呢?我尝试将 typeahead-no-results 添加到我的输入控件中,但这似乎不起作用

<input  type="text" runat="server" id="addressTypeAhead"  typeahead-no-results="No address found">



$('.typeahead').on('typeahead:selected', function (evt, item) {
        // set hidden var
        $('*[data-name="addressId"]').val(item.identifier);
    })

    // Instantiate the Typeahead UI
    $('.typeahead').typeahead({ minLength: 3 }, {
        displayKey: 'value',
        valueKey: 'identifier',
        items: 5,
        source: addresses.ttAdapter()
    });

我正在从其他地方的 Bloodhound 获取地址

【问题讨论】:

    标签: typeahead.js typeahead


    【解决方案1】:

    这对我有用:

    $('.typeahead').typeahead({ minLength: 3 }, {
        ....
        source: addresses.ttAdapter(), templates: {
            empty: '<div class="tt-no-result">No results found.</div>'
        }
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-13
      • 2017-01-10
      • 2020-05-14
      相关资源
      最近更新 更多