Bootstrap Typeahead - 未找到结果
Bootstrap Typeahead - no results found
使用 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').typeahead({ minLength: 3 }, {
....
source: addresses.ttAdapter(), templates: {
empty: '<div class="tt-no-result">No results found.</div>'
}
});
使用 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').typeahead({ minLength: 3 }, {
....
source: addresses.ttAdapter(), templates: {
empty: '<div class="tt-no-result">No results found.</div>'
}
});