Last Updated: February 25, 2016
· samccone

The secret behind filtering collectionViews in Marionette

Once upon a time a list needed to be filtered on demand.
Google has many solutions, many of which involve plugins and your data to be formatted per the plugins taste.

Wait tho! Marionette already can do this with your existing collectionView.

Hidden within the Marionette code base lies a handy little method waiting to be overridden

class List extends Marionette.CollectionView
  # ...
  addItemView: (item, ItemView, index) ->
    return unless item.shouldBeShown()

Simple indeed!

** Working Example **

3 Responses
Add your response

Hello I think the coding sample link you provided is broken

over 1 year ago ·

Or incomplete...

over 1 year ago ·

Now replaced with .filter on Marionette's CollectionView (which is extended by and therefore also usable in CompositeView). Check the docs:

over 1 year ago ·