Views within Views? How to generating lists of items with Backbone.js?

While it's certainly possible to write it that way, things can get convoluted if you have templates nesting views nesting templates, ad infinitum.

While it's certainly possible to write it that way, things can get convoluted if you have templates nesting views nesting templates, ad infinitum... Instead, why not insert your Book views into the list: render: -> $(this. El). Html this.template() bookHTML = for book in Books (new BookView model: book).render().

El this. $('. Book_list').

Append bookHTML.

Thanks! How would one use Underscore's filter methods to filter the books by author? – unpluggd Jan 25 at 22:09 2 Books.

Filter(function(book){ return book. Author == expectedAuthor; }); – jashkenas Jan 27 at 17:13 10 Will this approach leak BookViews every time render is called? If so, wouldn't it be hard to get rid of those views if they reference model objects that are still hanging around and valid?

– Brett Feb 2 at 19:34 4 Someone please answer Brett's question! – Chetan Apr 18 at 7:22 1 @Brett, @Chetan: AFAIK, as long as nothing is referencing the BookView instances (as they are being used to just extract the el property value), they'll be garbage collected on the next run. It doesn't matter if the BookView references el.

– Krof Drakula Sep 8 at 12:43.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions