derickbailey/backbone.marionette — Issue #36: extract CompositeView out of CollectionView
Author: derickbailey
Created: 2012-02-29 14:41:41+00:00
State: open

There's a high likelihood that this will end up being extended directly off CollectionView and just add a few more methods to make it work as a composite. I think the separation is necessary, though, to help avoid confusion and to help clean up the code. There's an issue in the code comments, here:

https://github.com/derickbailey/backbone.marionette/commit/c4e9af2dfd87fbe5bf2f8635b5dcdce3dc2e8e8d#commitcomment-1021737

that needs to be addressed when the extraction happens. I put in a quick hack in my own app to work around this but a good solution needs to be found. I don't think i wnat to change the way the HTML is attached. rather, I want to avoid re-rendering the ModelView when the collection is reset.

the hack i mention is to add these two lines to the top of the `renderModel` method in Marionette's CollectionView:

```js
if (this.modelViewRendered) { return; }
this.modelViewRendered = true;
```

This will prevent the model view from being re-rendered when the `reRender` method is called. There are likely some side effects / drawbacks to this approach, and a better solution needs to be found.