|
Lines 1-39
Link Here
|
| 1 |
/** |
|
|
| 2 |
* Apply the same filter to all DataTable instances on a particular page. The |
| 3 |
* function call exactly matches that used by `fnFilter()` so regular expression |
| 4 |
* and individual column sorting can be used. |
| 5 |
* |
| 6 |
* DataTables 1.10+ provides this ability through its new API, which is able to |
| 7 |
* to control multiple tables at a time. |
| 8 |
* `$('.dataTable').DataTable().search( ... )` for example will apply the same |
| 9 |
* filter to all tables on the page. The new API should be used in preference |
| 10 |
* to this older method if at all possible. |
| 11 |
* |
| 12 |
* @name fnFilterAll |
| 13 |
* @summary Apply a common filter to all DataTables on a page |
| 14 |
* @author [Kristoffer Karlström](http://www.kmmtiming.se/) |
| 15 |
* @deprecated |
| 16 |
* |
| 17 |
* @param {string} sInput Filtering input |
| 18 |
* @param {integer} [iColumn=null] Column to apply the filter to |
| 19 |
* @param {boolean} [bRegex] Regular expression flag |
| 20 |
* @param {boolean} [bSmart] Smart filtering flag |
| 21 |
* |
| 22 |
* @example |
| 23 |
* $(document).ready(function() { |
| 24 |
* var table = $(".dataTable").dataTable(); |
| 25 |
* |
| 26 |
* $("#search").keyup( function () { |
| 27 |
* // Filter on the column (the index) of this element |
| 28 |
* table.fnFilterAll(this.value); |
| 29 |
* } ); |
| 30 |
* }); |
| 31 |
*/ |
| 32 |
|
| 33 |
jQuery.fn.dataTableExt.oApi.fnFilterAll = function(oSettings, sInput, iColumn, bRegex, bSmart) { |
| 34 |
var settings = $.fn.dataTableSettings; |
| 35 |
|
| 36 |
for ( var i=0 ; i<settings.length ; i++ ) { |
| 37 |
settings[i].oInstance.fnFilter( sInput, iColumn, bRegex, bSmart); |
| 38 |
} |
| 39 |
}; |