This is an add-on for the DataTables plugin (v1.7.x) for jQuery that creates filtering widgets based on the data in table columns.
Find the DataTables source here: https://github.com/DataTables/DataTables
The included examples will only work within the DataTables source tree. Here's a quick git checkout:
$ git clone git@github.com:DataTables/DataTables.git
Cloning into DataTables...
...
$ cd DataTables
$ mkdir extras
$ git clone git@github.com:cyberhobo/ColumnFilterWidgets.git
Cloning into ColumnFilterWidgets...
For DataTables usage, please refer to the DataTables web-pages: http://www.datatables.net
ColumnFilterWidgets examples are also available there: http://www.datatables.net/extras/thirdparty/ColumnFilterWidgets/DataTables/extras/ColumnFilterWidgets/
The ColumnFilterWidgets source can be found in the media/js/ directory of this source tree.
Options are specified as a DataTables option, in an object called oColumnFilterWidgets
:
$( '#example_table' ).dataTable( {
bPaginate: true,
sDom: 'Wlfriptip',
sPaginationType: 'full_numbers',
oColumnFilterWidgets: {
aiExclude: [ 0, 6 ],
sSeparator: ', ',
bGroupTerms: true,
aoColumnDefs: [
{ bSort: false, sSeparator: ' / ', aiTargets: [ 2 ] },
{ fnSort: function( a, b ) { return a-b; }, aiTargets: [ 3 ] }
]
}
} );
The possible options are:
aiExclude
- an array of column indices for which column filter widgets should not be created.bGroupTerms
- enable grouping of selected terms in a singlediv
element.sSeparator
- enable parsing of column contents into multiple terms separated by this string.iMaxSelections
- allow at most this number of selections from each column filter widget.
Github offers ways to contribute code, write documentation, submit issues, suggest features, etc. Go nuts!
Donations are always encouraging.
ColumnFilterWidgets uses the same license as DataTables. DataTables is released with dual licensing, using the GPL v2 (license-gpl2.txt) and an BSD style license (license-bsd.txt). Please see the corresponding license file for details of these licenses. You are free to use, modify and distribute this software, but all copyright information must remain.