我有一个模型正在表单视图中被销毁,我还需要它从列表视图中删除相关元素。
在我的表单视图中,我有
删除:函数(){
this.model.destroy();
this.el.remove();
}
在我的列表视图中,我有
初始化:函数(){
this.model.on('remove',this.delete);
},
删除:函数(){
警报(“删除”);
this.el.remove();
this.el.unbind();
}
当我删除项目时,会触发 listView 中的删除,但出现错误cannot call method remove of undefined。
我也试过$(this.el).remove()了,但没有运气。listView 是从集合中添加到另一个视图中的
itemCollection.each(this.add);
添加:函数(){
var create = new Myapp.Views.Items({model:item});
$(this.el).append(create.el);
}