I have a collection of collections that I feed to my CompositeView. For each collection I am trying to show a rectangle and inside it show the first 3 models of that collection.
Since there could be more than 3 models per collection I want to trim it down to always be 3 or less. I am using mustache so I can't do it there so I'm thinking of doing it in serializeData for the childView or Show.Item but I'm confused I don't understand the context of serializeData function. When I look at this
it gives me the window object.
Where should I do this filtering?
collection 1
collection 1
model 1
model 2
model 3
collection 2
model 1
model 2
model 3
model 4
new Show.Items
collection: collection
class Show.Item extends App.Views.ItemView
template: "templates/_item"
class Show.Items extends App.Views.CompositeView
template: "templates/show"
childView: Show.Item
childViewContainer: '.items'
It seems the context of this is lost, the easiest way to solve this is binding all the methods using underscore's bindall