Backbone patterns
ricostacruz.com
ricostacruz.com
I would really love to know the best practice for this, because I was trying to work with something that basically amounted to a model with two or three collections as well as a few simple properties.
But, when I went searching a month or two ago I couldn't really find much in the way of how to handle this sort of nested collection. Is there a good example out there?
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.
I'm not being snarky or sarcastic - I personally would love to see some of the more advanced topics you mention included in the list of patterns, in particular loading events and optimisation. Unfortunately I don't think I know enough about Backbone to contribute anything useful - the only non-standard thing I have done so far is basic integration with Celery (https://github.com/mikery/django-celery-backbone).