5 ms·
i'm using something like that : SubModel,CollectionSubModel MainModel { subModelCollection : CollectionSubModel } ViewSubModel { model: SubModel, collection:
by devmach 15y ago
i'm using something like that :
SubModel,CollectionSubModel
MainModel { subModelCollection : CollectionSubModel }
ViewSubModel { model: SubModel, collection: MainModel.subModelCollection }
ViewSubModel listens model and collection ( using model.bind() and collection.bind() ). If someting happened, which should inform all submodels i fire an event with a collection.trigger(). Say if i want to hide MainModel, MainModel's View calls model.subModelCollection.trigger('hideParent') before remoing it's "el".
* : i'm sorry if you confused because of my explanation. i tried my best.