rotundasoftware / backbone.collectionView

Easily render backbone.js collections. In addition to managing model views, this class supports automatic selection of models in response to clicks, reordering models via drag and drop, and more.
http://rotundasoftware.github.io/backbone.collectionView/
Other
171 stars 27 forks source link

modified modelviewconstructor to support supplying a contructor... #60

Closed fabscav closed 9 years ago

fabscav commented 9 years ago

Hey guys,

Great work on the collectionView. Just added the possibility to supply a method instead of a class as "modelView" in order to support some kind of factory pattern when choosing the view, based on the model data (which is supplied as argument to the method). Thought you might like it. If not that's cool too.

FabScav

dgbeck commented 9 years ago

Hi @fabscav ! Thanks for the kind words and the contribution. Very much appreciate your input!

The _getModelViewConstructor method is intended to be easily overridable, so you can subclass the collection view and implement a factory pattern. White I'm not opposed to making this even easier in concept, I'm afraid there would be some ambiguity if we were to support a function as the modelView option, since view constructors are themselves functions.