【发布时间】:2014-02-04 12:08:39
【问题描述】:
我刚刚更新到 typeahead 的新版本 (v0.10.0),到目前为止我印象非常深刻。
但是,我找不到在呈现建议时跟踪事件的方法。以前我是这样做的:
myTypeahead = typeahead({.....});
myTypeahead.data('ttView').dropdownView.on('suggestionsRendered', function() {
// Suggestions is now rendered
});
但这现在失败了:
Uncaught TypeError: Cannot read property 'dropdownView' of undefined
你有什么想法吗?此处描述的任何自定义事件:https://github.com/twitter/typeahead.js/blob/master/doc/jquery_typeahead.md#custom-events 都不能解决问题。
【问题讨论】:
-
你不能改用“typeahead:opened”事件吗?
-
不,很遗憾没有。因为它只会触发一次,并且当追加新结果时,我需要使用 ajax 结果来操作一些 div。
-
查看我对相关 GitHub 问题的回复:github.com/twitter/typeahead.js/issues/…
标签: javascript jquery typeahead.js