tbranyen/backbone.layoutmanager — Issue #41: Typo in README
Author: simax
Created: 2012-02-10 16:30:15+00:00
State: open

In the *Rendering Consecutive Views* section of the README the template for the **SomeItem** view is set to **"#list"** and the template for the **SomeList** view is set to **"#item"**. This feels like its the wrong way round and is a bit confusing.

```javascript
// An example item View
// You may find it easier to have Backbone render the LI/TD/etc element
// instead of including this in your template. This is purely convention
// use what works for you.
var SomeItem = Backbone.View.extend({
template: "#list",

// In this case we'll say the item is an

tagName: "li"
});

// The view that contains the

w/e is used to contain your element.
//
// Since this method is used inside a custom render method, LayoutManager.View
// isn't useful for rendering a collection list.
var SomeList = Backbone.View.extend({
template: "#item",

render: function(layout) {
// Assign the layout view custom object to the view variable
var view = layout(this);

// Iterate over the passed collection and create a view for each item
this.collection.each(function(model) {
// Pass the model to the new SomeItem view
view.insert("ul", new SomeItem({
model: model
}));
});

// You still must return this view to render, works identical to the
// existing functionality.
return view.render();
}
});
```