【问题标题】:Pass the typed text to the remote request with typeahead bloodhound使用 typeahead bloodhound 将输入的文本传递给远程请求
【发布时间】:2015-07-14 14:15:53
【问题描述】:

我似乎在sometopics 大约the same issue,但他们似乎都在使用replace 选项。

此选项doesn't seem to exist anymore in the current bloodhound

现在我有以下根本没有显示任何结果:

var url = 'http://demo.com';

var suggestions = new Bloodhound({
    datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
    queryTokenizer: Bloodhound.tokenizers.whitespace,
    prefetch: [],
    remote: {
        url: url + '/equipment/getSuggestions/%QUERY'
    }
});


$('#equipment-id-input').typeahead({
    highlight: true,
    minLength: 3,
    source: suggestions
});

我不确定我是否做错了什么,因为没有显示错误。 有什么建议吗?

【问题讨论】:

    标签: typeahead.js twitter-typeahead bloodhound


    【解决方案1】:

    感谢this answer,我设法使它工作。

    虽然我不明白ttAdapter这个函数在做什么:

    $('.typeahead').typeahead(null, {
        displayKey: 'value',
        source: movies.ttAdapter()
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-03-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-18
      • 1970-01-01
      • 2021-10-25
      相关资源
      最近更新 更多