Twitter TypeAhead以编程方式显示所有结果 [英] Twitter TypeAhead show all results programmatically

查看:107
本文介绍了Twitter TypeAhead以编程方式显示所有结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在这一段时间里对此表示不满。 SO和其他网站上还有其他答案,如果我将输入的值更改为其他内容,则返回原始值,即会显示TypeAhead。

I've been busting my head on this for a while now. There are other answers floating around SO and other sites saying that if I change the value of my input to something else, then back to my original value, that TypeAhead will display.

在我的情况下没有任何工作。

Nothing is working in my case.

我检索我的结果如下:

$(element).typeahead({
    hint      : true,
    highlight : true, // This is to bold words that match the query
    minLength : queryLength
}, {
    name      : "results",
    displayKey: "value",
    source    : bhResults.ttAdapter()
});

之后,我试图强行显示一个下拉列表,其中包含所有结果:

After which, I've tried to forcefully display a drop down with all the results like so:

    window.setTimeout(function () {
        $(element).typeahead('val', value);
        $(element).focus();
        $(element).trigger("input");
        $(element).val('mood');
    }, 1000);

但是,什么都没有用!

推荐答案

其中一个github问题包含一个解决方法: https: //github.com/twitter/typeahead.js/issues/798

One of the github issues covers a workaround: https://github.com/twitter/typeahead.js/issues/798

这篇关于Twitter TypeAhead以编程方式显示所有结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆