Commit da8e959c authored by Craig Norris's avatar Craig Norris

Minor filter edits

Minor style edits to filter plugin page.
parent eefc8ab6
...@@ -11,11 +11,12 @@ to the dropdown using a simple fuzzy string search of an input value. ...@@ -11,11 +11,12 @@ to the dropdown using a simple fuzzy string search of an input value.
## Usage ## Usage
Add the `Filter` object to the plugins array of a `DropLab.prototype.init` or `DropLab.prototype.addHook` call. Add the `Filter` object to the plugins array of a `DropLab.prototype.init` or
`DropLab.prototype.addHook` call.
- `Filter` requires a configuration value for `template`. - `Filter`: Requires a configuration value for `template`.
- `template` should be the key of the objects within your data array that you want to compare - `template`: Should be the key of the objects within your data array that you
to the user input string, for filtering. want to compare to the user input string, for filtering.
```html ```html
<input href="#" id="trigger" data-dropdown-trigger="#list"> <input href="#" id="trigger" data-dropdown-trigger="#list">
...@@ -45,8 +46,10 @@ droplab.addData('trigger', [{ ...@@ -45,8 +46,10 @@ droplab.addData('trigger', [{
}]); }]);
``` ```
Above, the input string will be compared against the `test` key of the passed data objects. In the previous code, the input string is compared against the `test` key of the
passed data objects.
Optionally you can set `filterFunction` to a function. This function will be used instead Optionally you can set `filterFunction` to a function. This function will be
of `Filter`'s built in string search. `filterFunction` is passed 2 arguments, the first used instead of `Filter`'s built-in string search. `filterFunction` is passed
is one of the data objects, the second is the current input value. two arguments: the first is one of the data objects, and the second is the
current input value.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment