Reputation: 3783
Say ListTwoItemView
which is used to represent model ListTwoItem
, and that ListTwoItem
holds the ID of a ListOneItem
to which it is linked.
If the user deletes a ListOneItem
, all ListTwoItem
's that link to it should be deleted. Does it make sense if I bind the ListTwoItemView
to the linked ListOneItem
so that should the referenced item be deleted - the ListTwoItem
model and view are also both removed?
Upvotes: 0
Views: 355
Reputation: 9216
No it doesn't. Models do not know about views. What you normally do in that case is that your ListOneItem will destroy your ListTwoItem when it is destroyed itself.
This will raise a "delete" event on the collection the ListTwoItem is part of (if it is not part of anything, you must trigger an event yourself). Listen to that event and remove/rerender the view as needed.
Upvotes: 1