Twitter Typeahead建议限制

时间:2014-06-26 02:17:20

标签: typeahead.js

我使用的是最新版本的Typeahead(0.10.2),但我无法获得超过139条记录的插件。当我更改查询以返回140条记录时,我得到"空的"我创建的模板。

我做错了什么?

var engine = new Bloodhound({
  name: "courses",
  limit: 5000,
  prefetch: { url: "../../CFC/XXX.cfc?term=aa&returnformat=json",
              ajax: { dataType: "json", 
                      cache: false,
                      data:{ method: "Search" } 
                    }
  },
  remote: { url: "../../CFC/XXX.cfc?term=%QUERY&returnformat=json",
            ajax: { dataType: "json", 
                    cache: false,
                    data:{ method: "Search",
                    timeout: 5000 }
                  }
  },
  datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.value); },
  queryTokenizer: Bloodhound.tokenizers.whitespace
});

$("#Source").typeahead({
   minLength: 2,
   highlight: true},
   {
    name: "courses",
    displayKey: "value",
    timeout: 1000,
    source: engine.ttAdapter(),
    engine: engine,
    templates: { empty: [ '<div class="empty-message">',
                          'Unable to find any courses that match your entry.',
                          '</div>'
                        ].join('\n')
    }
});

1 个答案:

答案 0 :(得分:0)

看起来当前版本的typeahead存在错误。 110被解析为10. 10被解析为0. 10记录== 0!耶!

相关问题