-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Returning collectionView on renderCollection(). #41
Conversation
Return collectionView in renderCollection()
changed docs.
+1 This is a pretty easy change w/ minimal risk. |
👍 With a small nitpick: I think we should mention it somewhere in the readme docs and example for renderCollection. |
If we document it, it needs to be enforced by a test |
We need a minor doc update saying the subview is returned and a simple test. I'm a +1 once those are in place. Any core dev feel free to merge/publish this as a |
@@ -350,6 +350,7 @@ _.extend(View.prototype, { | |||
var collectionView = new CollectionView(config); | |||
collectionView.render(); | |||
this.registerSubview(collectionView); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
registerSubview
actually returns the reference so this could just be:
return this.registerSubview(collectionView);
/me shrugs, either way. But there should be tests to make sure we don't accidentally change this behavior once implemented.
Just return this.registerSubview(collectionView);
Returning collectionView on renderCollection().
I'm going to merge this and update docs and add a test before publishing. |
To make it possible to track your model views of your collections. It is very handy to have a reference to the collectionView. Currently you can only use a syntax like this._subviews[1].views but this is rather hacky, nor do you exactly know what view it is.
By giving renderCollection() a return value of collectionView you can easily do
this.views = this.renderCollection();
_.each(this.views, function(view){});