When to Use
When you have lots of rows with lots of text, and you just want to quickly get to the row that only contain certain keywords.
Prerequisites
There are no extra dependencies for ServerSideFilter
and
ClientSideFilter
.
For LunrFilter
, it has a hard dependency on lunr.js for
full-text searching.
ServerSideFilter
ServerSideFilter is suitable if you have a server where you send the search queries to get back a result. The follow example will create a collection that uses Github's excellent API to search for Github users. See here for the valid search terms to use.
ClientSideFilter
LunrFilter
Pro Tip
ClientSideFilter and LunrFilter won't work unless the collection
contains all the data for filtering at the time the filters are
initialized. If you are fetching data after the filters were
initialized and using Backbone 1.0.0+, you should pass {remove:
true}
or {reset: true}
to
Collection#fetch()
due to the change to
Collection#set()
after fetching.