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()
super
Simple indeed!

** Working Example **
Written by Sam Saccone
Related protips
3 Responses
Hello I think the coding sample link you provided is broken
Or incomplete...
Now replaced with .filter on Marionette's CollectionView (which is extended by and therefore also usable in CompositeView). Check the docs: https://github.com/marionettejs/backbone.marionette/blob/master/docs/marionette.collectionview.md#collectionviews-filter
Have a fresh tip? Share with Coderwall community!
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside