Skip to content

Commit

Permalink
extracted filters to their own plugin, refactored api logic
Browse files Browse the repository at this point in the history
- filtering plugin is now under datatables-improved-filters
- refactored .meta api calls to be more useful and granular
- readme updates
  • Loading branch information
kjhangiani committed Mar 25, 2016
1 parent 9181896 commit d005c20
Show file tree
Hide file tree
Showing 3 changed files with 328 additions and 381 deletions.
22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Datatables-Metadata
Datatables Metadata Plugin - Adds API hooks for column metadata, as well as advanced range filters.
Datatables Metadata Plugin - Adds API hooks for column metadata

This plugin is best used in conjunction with `datatables-improved-filters`, which will allow more advanced column specific filtering.

# Installation

Expand Down Expand Up @@ -31,18 +33,12 @@ This plugin provides the following additional API calls:
Store column specific metadata in the datatable. This is used by the filtering functions below, but can also be used to store arbitrary data related to the column as required. This data is state saved if state saving is enabled.

- `.column().meta()` // retrieve meta information for a column
- `.column().meta(obj)` // set the metadata for a column to the specified object (replaces any existing metadata)
- `.column().meta(key, data)` // set the `key` property in the column metadata object to `data`

### Numeric Range Filters

- `.column().range(min, max)` // numeric range filtering for a column. either min or max can be `null` to enable one sided filtering
- `.column().range()` // clear numeric range filters on this column

### Date Range Filters (requires moment.js)

- `.column().dateRange(min, max)` // date range filtering for a column. either min or max can be `null` to enable one sided filtering. Values can be strings (parsed via moment.js) or JS date objects
- `.column().dateRange()` // clear date range filters on this column
- `.column().meta(key)` // retrieve meta information for a column, under the key `key`
- `.column().meta.replace(data)` // set the entire column meta to the object passed in as `data`
- `.column().meta.clear()` // remove all metadata for this column
- `.column().meta.set(key, data)` // set the `key` property in the column metadata object to `data`
- `.column().meta.merge(key, data)` // merge the `key` property in the column metadata object with the object passed in to `data`
- `.column().meta.remove(key)` // remove all metadata under `key`


### Utility
Expand Down
3 changes: 1 addition & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"description": "jquery-datatables metadata plugin, adds column specific metadata, and useful API calls for range filtering",
"main": "js/dataTables.metadata.js",
"dependencies": {
"jquery": ">=1.7.0",
"datatables": ">=1.10.8"

},
"keywords": [
"datatables",
Expand Down
Loading

0 comments on commit d005c20

Please sign in to comment.