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
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: https://github.com/marionettejs/backbone.marionette/blob/master/docs/marionette.collectionview.md#collectionviews-filter
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Coffeescript
Authors
iam4x
94.17K
ericdfields
63.02K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#