filtering data in serializeData

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

enter image description here

  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'


Download filtering.data.in.serializedata.zip
Direct Link


Download


Download filtering.data.in.serializedata.zip
Mediafire


Download


Download filtering.data.in.serializedata.zip
Keep2Share


Download

Both comments and pings are currently closed.

Comments are closed.