
Backbone patterns - kjventura
http://ricostacruz.com/backbone-patterns/
======
radagaisus
This is all fairly basic patterns. More interesting patterns are using
collections inside a model, using sparse arrays or transparent loading (for
infinite scroll), creating a "loading" event and handling loading, optimizing
number of render calls, complicated routes, and using a vent to pass events
and information between views. Those are the 'tougher' challenges I deal with
on my backbone apps.

~~~
ben1040
_collections inside a model_

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?

~~~
devmach
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.

------
cosmez
Thanks a lot, just when i started using Backbone!

------
Void_
Most of these are applicable to Spine, which I recommend you all give a try.

