From: Scott Baker Date: Mon, 8 Dec 2014 22:45:39 +0000 (-0800) Subject: filtering the collection was the very very wrong way to go about it X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=5ff31bd5ec59c596ff86c5399e281fcec27d862d;p=plstackapi.git filtering the collection was the very very wrong way to go about it --- diff --git a/planetstack/core/xoslib/static/js/xoslib/xos-backbone.js b/planetstack/core/xoslib/static/js/xoslib/xos-backbone.js index 1f4ca5b..a39737d 100644 --- a/planetstack/core/xoslib/static/js/xoslib/xos-backbone.js +++ b/planetstack/core/xoslib/static/js/xoslib/xos-backbone.js @@ -258,6 +258,14 @@ if (! window.XOSLIB_LOADED ) { model.fetch(options); }, + /* filterBy: note that this yields a new collection. If you pass that + collection to a CompositeView, then the CompositeView won't get + any events that trigger on the original collection. + + Using this function is probably wrong, and I wrote + FilteredCompositeView() to replace it. + */ + filterBy: function(fieldName, value) { filtered = this.filter(function(obj) { return obj.get(fieldName) == value;