updating an object from another view
I have a backbone view (ItemDetailedView) which container another view
(ShopItemDetailedView). Inside the ShopItemDetailed view I have an img
that when clicked it needs to updates the ItemDetailed model. In other
words it needs to call fetch on the ItemDetailed model. How can I do this
on the ShopItemDetailed? I was thinking of passing the item model to the
shop model and then set the id of the item. However I dont think that this
is a good solution as it is against the decoupling principle. Here's some
code on my ShopItemDetailedView
loadNewItem: function(itemid) {
//i want to change set the item id here that is on ItemDetailedView
},
I was thinking of the publisher and subscriber method, such that on this
event I would publish an event that sends the new id of the item it should
fetch. Not sure on how to do that though
No comments:
Post a Comment