フォームビューで破棄されているモデルがあり、リストビューから関連する要素も削除する必要があります。
私のフォームビューで私は持っています
削除:function(){ this.model.destroy(); this.el.remove(); }
そして私のリストビューで私は持っています
初期化:function(){ this.model.on('remove'、this.delete); }、 削除:function(){ alert('削除'); this.el.remove(); this.el.unbind(); }
アイテムを削除すると、listViewの削除がトリガーされますが、エラーが発生しますcannot call method remove of undefined
。
私も試しまし$(this.el).remove()
たが、運がありません。listViewは、コレクションから別のビューに追加されます。
itemCollection.each(this.add); 追加:function(){ var create = new Myapp.Views.Items({model:item}); $(this.el).append(create.el); }