0
我已經在我的應用程序中實現了nested_form gem和twitter類型。但是我不能在動態添加的字段中使用這個typeahead。nested_form和twitter typeahead
我的線,其將所述動態線是 <%= ff.link_to_add噸( 「add_author」),:book_authors,:數據=> {:目標=> 「#authors」}%>
而第一行的鍵入的JS是:
$(function(){
var authors = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('author'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
limit: 10,
remote: {
url: '/load_suggestions?q=%QUERY',
filter: function(list) {
return $.map(list, function(author) { return {author: book }; });
}
}
});
authors.initialize();
$('#load_suggestions').typeahead({
hint: true,
highlight: true,
minLength: 1
},
{
name: 'authors',
displayKey: 'author',
source: authors.ttAdapter()
});
});
如何修改上述內容以適用於動態添加的行?謝謝
讓我試試看,我會回來。非常感謝 – Tiamon 2014-08-29 18:36:47
解決。非常感謝! – Tiamon 2014-08-29 18:56:58
您好,我已經在正常的頁面上工作,但它不適用於引導模式。任何建議爲模態?謝謝 – Tiamon 2014-09-01 22:38:16