Class: FilteringCollection

js-whatever/js/filtering-collection. FilteringCollection

new FilteringCollection(models, Options)

Collection which tracks another collection. Models added to the tracked collection are only added to the
FilteringCollection if they pass the modelFilter function. If the tracked model changes, the modelFilter is applied
again and if it passes the new attributes are set on the tracking model, or if it fails the model is removed.
Models removed from the tracked collection are removed from the FilteringCollection.

Parameters:
Name Type Description
models Array.<Backbone.Model>

Initial models

Options module:js-whatever/js/filtering-collection.FilteringCollection~FilteringCollectionOptions

for the filtering collection

Source:

Extends

  • Backbone.Collection

Methods

filter(filters)

Updates the filters data to the method parameter and re-filters the collection

Parameters:
Name Type Description
filters Object

New filters data

Source:

Type Definitions

FilteringCollectionOptions

Properties:
Name Type Argument Default Description
collection Backbone.Collection

The collection to track

modelFilter module:js-whatever/js/filtering-collection.FilteringCollection~modelFilter
filters Object <optional>
{}

Initial filters data which will be passed to the modelFilter

Source:

modelFilter(model, filters) → {Boolean}

Parameters:
Name Type Description
model Backbone.Model

The model to check against the filter

filters Object

Filters data

Source:
Returns:

True if the model passes the filter, false if not

Type
Boolean
Copyright 2013-2018 Micro Focus International plc. Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
Documentation generated by JSDoc 3.4.3 on Thu Jun 21st 18:04 2018 using the DocStrap template.