これが私の問題です
私はいくつかのデータを取得する非常に単純なバックボーン コレクションを持っています。次のようにすべてが正常に機能します。
DealershipContacts.Collection = Backbone.Collection.extend({
url:jarvisUrl ("dealership_contacts"),
parse:function(response) {
console.log('parse called');
return response.data;
},
initialize : function(){
_.bindAll(this, 'reset', 'parse');
}
});
fetch が呼び出されると、期待どおりに解析ログがコンソールに出力されます。
しかし、その後、リセット イベントをリッスンして、コレクションを使用してブートストラップの先行入力のソース データを設定できるようにしたいと考えています。だから私はこれをしました:
DealershipContacts.Collection = Backbone.Collection.extend({
url:jarvisUrl ("dealership_contacts"),
parse:function(response) {
console.log('parse called');
console.log(response);
return response.data;
},
reset:function(){
console.log("change fired");
$('.dealership_typeahead').typeahead({source:this.pluck('user_name')});
return true;
},
initialize : function(){
_.bindAll(this, 'reset', 'parse');
}
});
そして今、解析イベントは発生せず、コレクションは作成されません。理由がわかりません。
どんな洞察も大歓迎です、ありがとう。