Compare commits

..

No commits in common. 'master' and 'gh-pages' have entirely different histories.

@ -1 +0,0 @@
Are you happy for it to be included and distributed under the MIT license? ✔️/❌

1
.gitignore vendored

@ -1 +0,0 @@
node_modules

@ -1,12 +0,0 @@
{
"arrowParens": "avoid",
"breakBeforeElse": true,
"indentChains": true,
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"useTabs": true
}

@ -1,3 +0,0 @@
Please post support requests and questions in the DataTables forums at https://datatables.net/forums. Support requests posted here will be closed. The intention of this request is to allow all questions to be located in a single, searchable, location.
When you post your question in the DataTables forums, please ensure that you include a link to the page showing the issue so it can be debugged.

@ -1,20 +0,0 @@
Copyright (c) 2010-2015 SpryMedia Limited
http://datatables.net
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

@ -1,9 +1,9 @@
DataTables Plugins
==================
This repository contains a collection of plug-ins for the jQuery [DataTables](http://datatables.net) table enhancer. These plug-ins are feature enhancing for the DataTables library, adding extra options to core functionality such as additional sort algorithms, API methods and pagination controls. The plug-ins should not be confused with DataTables "extensions" which are more significant software libraries which add additional features to DataTables.
This repository contains a collection of plug-ins for the jQuery [DataTables](http://datatables.net) table enhancer. These plug-ins are feature enhancing for the DataTables library, adding extra options to core functionality such as additional sort algorithms, API methods and pagination controls. The plug-ins should not be confused with DataTables "extras" which are more significant software libraries which add additional features to DataTables.
This repository holds the following plug-in types for DataTables (among others):
This repository holds the following plug-in types for DataTables:
* Sorting
* Type based
@ -15,11 +15,7 @@ This repository holds the following plug-in types for DataTables (among others):
* Internationalisation translations
* Type detection
* Pagination
* Integration scripts
* Twitter Bootstrap
Please refer to the DataTables [plug-in documentation](http://datatables.net/plug-ins) for details on how to use these plug-ins.
## Internationalisation
In the case of i18n Plugins, we ask that you don't create a pull request and instead make use of the [management system](https://datatables.net/plug-ins/i18n/) that we have in place for this on our website. Changes there will be synced up to this repo.
Each directory has an index.html file which is used to generate the plug-ins documentation on [DataTables.net](http://datatables.net/plug-ins) and describes how plug-ins can be used.

@ -1,8 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
declare module 'datatables.net' {
interface Api<T> {
/** Average the values in a data set. */
average(): Number;
}
}
export {};

@ -1,81 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window === 'undefined') {
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.document );
}
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* It can sometimes be useful to get the average of data in an API result set,
* be it from a column, or a collection of cells. This method provides exactly
* that ability.
*
* @name average()
* @summary Average the values in a data set.
* @author [Allan Jardine](http://sprymedia.co.uk)
* @requires DataTables 1.10+
*
* @returns {Number} Calculated average
*
* @example
* // Average a column
* var table = $('#example').DataTable();
* table.column( 3 ).data().average();
*
* @example
* // Average two cells
* var table = $('#example').DataTable();
* table.cells( 0, [3,4] ).data().average();
*/
DataTable.Api.register('average()', function () {
var data = this.flatten();
var sum = data.reduce(function (a, b) {
return a * 1 + b * 1; // cast values in-case they are strings
}, 0);
return sum / data.length;
});
return DataTable;
}));

@ -1,2 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(t){var o,r;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?(o=require("jquery"),r=function(e,n){n.fn.dataTable||require("datatables.net")(e,n)},"undefined"==typeof window?module.exports=function(e,n){return e=e||window,n=n||o(e),r(e,n),t(n,0,e.document)}:(r(window,o),module.exports=t(o,window,window.document))):t(jQuery,window,document)}(function(e,n,t,o){"use strict";e=e.fn.dataTable;return e.Api.register("average()",function(){var e=this.flatten();return e.reduce(function(e,n){return+e+ +n},0)/e.length}),e});

@ -1,2 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;DataTable.Api.register("average()",function(){var e=this.flatten();return e.reduce(function(e,t){return+e+ +t},0)/e.length});export default DataTable;

@ -1,40 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
import jQuery from 'jquery';
import DataTable from 'datatables.net';
// Allow reassignment of the $ variable
let $ = jQuery;
/**
* It can sometimes be useful to get the average of data in an API result set,
* be it from a column, or a collection of cells. This method provides exactly
* that ability.
*
* @name average()
* @summary Average the values in a data set.
* @author [Allan Jardine](http://sprymedia.co.uk)
* @requires DataTables 1.10+
*
* @returns {Number} Calculated average
*
* @example
* // Average a column
* var table = $('#example').DataTable();
* table.column( 3 ).data().average();
*
* @example
* // Average two cells
* var table = $('#example').DataTable();
* table.cells( 0, [3,4] ).data().average();
*/
DataTable.Api.register('average()', function () {
var data = this.flatten();
var sum = data.reduce(function (a, b) {
return a * 1 + b * 1; // cast values in-case they are strings
}, 0);
return sum / data.length;
});
export default DataTable;

@ -1,12 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
declare module 'datatables.net' {
interface ApiColumnMethods {
/** Get searchable flag for selected column */
searchable(): boolean;
}
interface ApiColumnsMethods {
/** Get searchable flag for selected columns */
searchable(): Api<boolean>;
}
}
export {};

@ -1,76 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window === 'undefined') {
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.document );
}
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* The plug-in provides a way to determine the searchable state of one or more
* columns, as was configured by the `-init columns.searchable` option.
*
* @name columns().order()
* @summary Apply multi-column ordering through the columns() API method.
* @author [Allan Jardine](http://sprymedia.co.uk)
* @requires DataTables 1.10+
*
* @returns {boolean|DataTables.Api} Searchable flag
*
* @example
* // Get the searchable flag for all columns
* table.columns().searchable().toArray()
*
* @example
* // Get the searchable flag for column index 0
* table.column(0).searchable()
*/
DataTable.Api.registerPlural('columns().searchable()', 'column().searchable()', function (selector, opts) {
return this.iterator('column', function (settings, column) {
return settings.aoColumns[column].bSearchable;
}, 1);
});
return DataTable;
}));

@ -1,2 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(t){var o,u;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?(o=require("jquery"),u=function(e,n){n.fn.dataTable||require("datatables.net")(e,n)},"undefined"==typeof window?module.exports=function(e,n){return e=e||window,n=n||o(e),u(e,n),t(n,0,e.document)}:(u(window,o),module.exports=t(o,window,window.document))):t(jQuery,window,document)}(function(e,n,t,o){"use strict";e=e.fn.dataTable;return e.Api.registerPlural("columns().searchable()","column().searchable()",function(e,n){return this.iterator("column",function(e,n){return e.aoColumns[n].bSearchable},1)}),e});

@ -1,2 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;DataTable.Api.registerPlural("columns().searchable()","column().searchable()",function(a,e){return this.iterator("column",function(a,e){return a.aoColumns[e].bSearchable},1)});export default DataTable;

@ -1,35 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
import jQuery from 'jquery';
import DataTable from 'datatables.net';
// Allow reassignment of the $ variable
let $ = jQuery;
/**
* The plug-in provides a way to determine the searchable state of one or more
* columns, as was configured by the `-init columns.searchable` option.
*
* @name columns().order()
* @summary Apply multi-column ordering through the columns() API method.
* @author [Allan Jardine](http://sprymedia.co.uk)
* @requires DataTables 1.10+
*
* @returns {boolean|DataTables.Api} Searchable flag
*
* @example
* // Get the searchable flag for all columns
* table.columns().searchable().toArray()
*
* @example
* // Get the searchable flag for column index 0
* table.column(0).searchable()
*/
DataTable.Api.registerPlural('columns().searchable()', 'column().searchable()', function (selector, opts) {
return this.iterator('column', function (settings, column) {
return settings.aoColumns[column].bSearchable;
}, 1);
});
export default DataTable;

@ -1,8 +0,0 @@
/*! © Alejandro Navarro - datatables.net/license */
declare module 'datatables.net' {
interface ApiColumnMethods {
/** Get the title of a column */
title(): string;
}
}
export {};

@ -1,72 +0,0 @@
/*! © Alejandro Navarro - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window === 'undefined') {
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.document );
}
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* This plug-in will read the text from the header cell of a column, returning
* that value.
*
* @name column().title()
* @summary Get the title of a column
* @author Alejandro Navarro
* @requires DataTables 1.10+
*
* @returns {String} Column title
*
* @example
* // Read the title text of column index 3
* var table = $('#example').DataTable();
* table.column( 3 ).title();
*/
DataTable.Api.register('column().title()', function () {
var title = this.header();
return $(title).text().trim();
});
return DataTable;
}));

@ -1,2 +0,0 @@
/*! © Alejandro Navarro - datatables.net/license */
!function(t){var o,i;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?(o=require("jquery"),i=function(e,n){n.fn.dataTable||require("datatables.net")(e,n)},"undefined"==typeof window?module.exports=function(e,n){return e=e||window,n=n||o(e),i(e,n),t(n,0,e.document)}:(i(window,o),module.exports=t(o,window,window.document))):t(jQuery,window,document)}(function(n,e,t,o){"use strict";var i=n.fn.dataTable;return i.Api.register("column().title()",function(){var e=this.header();return n(e).text().trim()}),i});

@ -1,2 +0,0 @@
/*! © Alejandro Navarro - datatables.net/license */
import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;DataTable.Api.register("column().title()",function(){var t=this.header();return $(t).text().trim()});export default DataTable;

@ -1,31 +0,0 @@
/*! © Alejandro Navarro - datatables.net/license */
import jQuery from 'jquery';
import DataTable from 'datatables.net';
// Allow reassignment of the $ variable
let $ = jQuery;
/**
* This plug-in will read the text from the header cell of a column, returning
* that value.
*
* @name column().title()
* @summary Get the title of a column
* @author Alejandro Navarro
* @requires DataTables 1.10+
*
* @returns {String} Column title
*
* @example
* // Read the title text of column index 3
* var table = $('#example').DataTable();
* table.column( 3 ).title();
*/
DataTable.Api.register('column().title()', function () {
var title = this.header();
return $(title).text().trim();
});
export default DataTable;

@ -1,8 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
declare module 'datatables.net' {
interface ApiColumnsMethods {
/** pply multi-column ordering through the columns() */
order(dir: 'asc' | 'desc'): Api<any>;
}
}
export {};

@ -1,95 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window === 'undefined') {
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.document );
}
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* The DataTables core library provides the ability to set the ordering via the
* `dt-api column().order()` method, but there is no plural equivalent. While
* multi-column ordering can be set using `dt-api order()` that method requires
* that column indexes be used.
*
* This plug-in provides the plural `columns().order()` method so you can set
* multi-column ordering, while retaining the benefits of the `dt-api columns()`
* selector options.
*
* @name columns().order()
* @summary Apply multi-column ordering through the columns() API method.
* @author [Allan Jardine](http://sprymedia.co.uk)
* @requires DataTables 1.10+
* @param {string|array} dir The order to apply to the columns selected. This
* can be a string (`asc` or `desc`) which will be applied to all columns,
* or an array (again `asc` or `desc` as the elements in the array) which is
* the same length as the number of columns selected, and will be applied to
* the columns in sequence.
*
* @returns {DataTables.Api} DataTables API instance
*
* @example
* // Apply multi-column sorting with a common direction
* table.columns( [ 1, 2 ] ).order( 'desc' ).draw();
*
* @example
* // Multi-column sorting with individual direction for the columns
* table.columns( [ 1, 2 ] ).order( [ 'desc', 'asc' ] ).draw();
*
* @example
* // Multi-column sorting based on a name selector
* table.columns( [ 'sign_up_date:name', 'user_name:name' ] ).order( 'desc' ).draw();
*/
DataTable.Api.register('columns().order()', function (dir) {
return this.iterator('columns', function (settings, columns) {
var a = [];
for (var i = 0, ien = columns.length; i < ien; i++) {
a.push([columns[i], Array.isArray(dir) ? dir[i] : dir]);
}
new DataTable.Api(settings).order(a);
});
});
return DataTable;
}));

@ -1,2 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(t){var r,o;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?(r=require("jquery"),o=function(e,n){n.fn.dataTable||require("datatables.net")(e,n)},"undefined"==typeof window?module.exports=function(e,n){return e=e||window,n=n||r(e),o(e,n),t(n,0,e.document)}:(o(window,r),module.exports=t(r,window,window.document))):t(jQuery,window,document)}(function(e,n,t,r){"use strict";var u=e.fn.dataTable;return u.Api.register("columns().order()",function(i){return this.iterator("columns",function(e,n){for(var t=[],r=0,o=n.length;r<o;r++)t.push([n[r],Array.isArray(i)?i[r]:i]);new u.Api(e).order(t)})}),u});

@ -1,2 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;DataTable.Api.register("columns().order()",function(i){return this.iterator("columns",function(r,a){for(var e=[],t=0,o=a.length;t<o;t++)e.push([a[t],Array.isArray(i)?i[t]:i]);new DataTable.Api(r).order(e)})});export default DataTable;

@ -1,54 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
import jQuery from 'jquery';
import DataTable from 'datatables.net';
// Allow reassignment of the $ variable
let $ = jQuery;
/**
* The DataTables core library provides the ability to set the ordering via the
* `dt-api column().order()` method, but there is no plural equivalent. While
* multi-column ordering can be set using `dt-api order()` that method requires
* that column indexes be used.
*
* This plug-in provides the plural `columns().order()` method so you can set
* multi-column ordering, while retaining the benefits of the `dt-api columns()`
* selector options.
*
* @name columns().order()
* @summary Apply multi-column ordering through the columns() API method.
* @author [Allan Jardine](http://sprymedia.co.uk)
* @requires DataTables 1.10+
* @param {string|array} dir The order to apply to the columns selected. This
* can be a string (`asc` or `desc`) which will be applied to all columns,
* or an array (again `asc` or `desc` as the elements in the array) which is
* the same length as the number of columns selected, and will be applied to
* the columns in sequence.
*
* @returns {DataTables.Api} DataTables API instance
*
* @example
* // Apply multi-column sorting with a common direction
* table.columns( [ 1, 2 ] ).order( 'desc' ).draw();
*
* @example
* // Multi-column sorting with individual direction for the columns
* table.columns( [ 1, 2 ] ).order( [ 'desc', 'asc' ] ).draw();
*
* @example
* // Multi-column sorting based on a name selector
* table.columns( [ 'sign_up_date:name', 'user_name:name' ] ).order( 'desc' ).draw();
*/
DataTable.Api.register('columns().order()', function (dir) {
return this.iterator('columns', function (settings, columns) {
var a = [];
for (var i = 0, ien = columns.length; i < ien; i++) {
a.push([columns[i], Array.isArray(dir) ? dir[i] : dir]);
}
new DataTable.Api(settings).order(a);
});
});
export default DataTable;

@ -0,0 +1,55 @@
/**
* Add a new row to the table and display it on the screen by jumping the
* pagination to the required location. This function also returns an object
* with the added TR element and it's index in aoData such that you could
* provide an effect (fade for example) to show which row has been added.
* This function is a drop in replacement for fnAddData with one important
* exception, it will only take a 1D array or an object, and not a 2D array
* (i.e. it will not add multiple rows like fnAddData).
* @name fnAddDataAndDisplay
* @anchor fnAddDataAndDisplay
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
*
* @example
* $(document).ready(function() {
* var oTable = $('#example').dataTable();
* oTable.fnAddDataAndDisplay( [ 1, 2, 3, 4, 5, ... ] );
* } );
*/
$.fn.dataTableExt.oApi.fnAddDataAndDisplay = function ( oSettings, aData )
{
/* Add the data */
var iAdded = this.oApi._fnAddData( oSettings, aData );
var nAdded = oSettings.aoData[ iAdded ].nTr;
/* Need to re-filter and re-sort the table to get positioning correct, not perfect
* as this will actually redraw the table on screen, but the update should be so fast (and
* possibly not alter what is already on display) that the user will not notice
*/
this.oApi._fnReDraw( oSettings );
/* Find it's position in the table */
var iPos = -1;
for( var i=0, iLen=oSettings.aiDisplay.length ; i<iLen ; i++ )
{
if( oSettings.aoData[ oSettings.aiDisplay[i] ].nTr == nAdded )
{
iPos = i;
break;
}
}
/* Get starting point, taking account of paging */
if( iPos >= 0 )
{
oSettings._iDisplayStart = ( Math.floor(i / oSettings._iDisplayLength) ) * oSettings._iDisplayLength;
this.oApi._fnCalculateEnd( oSettings );
}
this.oApi._fnDraw( oSettings );
return {
"nTr": nAdded,
"iPos": iAdded
};
};

@ -0,0 +1,55 @@
/**
* Take a TR element and add it to a DataTables table. Useful for maintaining
* custom classes and other attributes.
* @name fnAddTr
* @anchor fnAddTr
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
*
* @example
*
*/
$.fn.dataTableExt.oApi.fnAddTr = function ( oSettings, nTr, bRedraw ) {
if ( typeof bRedraw == 'undefined' )
{
bRedraw = true;
}
var nTds = nTr.getElementsByTagName('td');
if ( nTds.length != oSettings.aoColumns.length )
{
alert( 'Warning: not adding new TR - columns and TD elements must match' );
return;
}
var aData = [];
var aInvisible = [];
for ( var i=0 ; i<nTds.length ; i++ )
{
aData.push( nTds[i].innerHTML );
if (!oSettings.aoColumns[i].bVisible)
{
aInvisible.push( i );
}
}
/* Add the data and then replace DataTable's generated TR with ours */
var iIndex = this.oApi._fnAddData( oSettings, aData );
nTr._DT_RowIndex = iIndex;
oSettings.aoData[ iIndex ].nTr = nTr;
oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
// Hidding invisible columns
for ( var i = (aInvisible.length - 1) ; i >= 0 ; i-- )
{
oSettings.aoData[iIndex]._anHidden[ i ] = nTds[aInvisible[i]];
nTr.removeChild( nTds[aInvisible[i]] );
}
// Redraw
if ( bRedraw )
{
this.oApi._fnReDraw( oSettings );
}
};

@ -0,0 +1,18 @@
/**
* When DataTables removes columns from the display (bVisible or
* fnSetColumnVis) it removes these elements from the DOM, effecting the
* index value for the column positions. This function converts the data
* column index (i.e. all columns regardless of visibility) into a visible
* column index.
* @name fnColumnIndexToVisible
* @anchor fnColumnIndexToVisible
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
*
* @example
*
*/
$.fn.dataTableExt.oApi.fnColumnIndexToVisible = function ( oSettings, iMatch )
{
return oSettings.oApi._fnColumnIndexToVisible( oSettings, iMatch );
};

@ -0,0 +1,18 @@
/**
* Update the internal data for a TR element based on what is used in the
* DOM. You will likely want to call fnDraw() after this function.
* @name fnDataUpdate
* @anchor fnDataUpdate
* @author Lior Gerson
*
* @example
*
*/
$.fn.dataTableExt.oApi.fnDataUpdate = function ( oSettings, nRowObject, iRowIndex )
{
$(nRowObject).find("TD").each( function(i) {
var iColIndex = oSettings.oApi._fnVisibleToColumnIndex( oSettings, i );
oSettings.oApi._fnSetCellData( oSettings, iRowIndex, iColIndex, $(this).html() );
} );
};

@ -0,0 +1,42 @@
/**
* Take a TR element and alter the table's paging to show the TR in question.
* @name fnDisplayRow
* @anchor fnDisplayRow
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
*
* @example
* $(document).ready(function() {
* // Display the 21st row in the table
* var oTable = $('#example').dataTable();
* oTable.fnDisplayRow( oTable.fnGetNodes()[20] );
* } );
*/
$.fn.dataTableExt.oApi.fnDisplayRow = function ( oSettings, nRow )
{
// Account for the "display" all case - row is already displayed
if ( oSettings._iDisplayLength == -1 )
{
return;
}
// Find the node in the table
var iPos = -1;
for( var i=0, iLen=oSettings.aiDisplay.length ; i<iLen ; i++ )
{
if( oSettings.aoData[ oSettings.aiDisplay[i] ].nTr == nRow )
{
iPos = i;
break;
}
}
// Alter the start point of the paging display
if( iPos >= 0 )
{
oSettings._iDisplayStart = ( Math.floor(i / oSettings._iDisplayLength) ) * oSettings._iDisplayLength;
this.oApi._fnCalculateEnd( oSettings );
}
this.oApi._fnDraw( oSettings );
};

@ -0,0 +1,26 @@
/**
* Set the point at which DataTables will start it's display of data in the
* table.
* @name fnDisplayStart
* @anchor fnDisplayStart
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
*
* @example
*
*/
$.fn.dataTableExt.oApi.fnDisplayStart = function ( oSettings, iStart, bRedraw )
{
if ( typeof bRedraw == 'undefined' )
{
bRedraw = true;
}
oSettings._iDisplayStart = iStart;
oSettings.oApi._fnCalculateEnd( oSettings );
if ( bRedraw )
{
oSettings.oApi._fnDraw( oSettings );
}
};

@ -0,0 +1,61 @@
/**
* Creates rowspan cells in a column when there are two or more cells in a
* row with the same content, effectively grouping them together visually.
* <b>Note</b> - this plug-in currently only operates correctly with
* <b>server-side processing</b>.
* @name fnFakeRowspan
* @anchor fnFakeRowspan
* @author Fredrik Wendel
*
* @example
* $('#example').dataTable().fnFakeRowspan(3);
*/
$.fn.dataTableExt.oApi.fnFakeRowspan = function ( oSettings, iColumn, bCaseSensitive ) {
/* Fail silently on missing/errorenous parameter data. */
if (isNaN(iColumn)) {
return false;
}
if (iColumn < 0 || iColumn > oSettings.aoColumns.length-1) {
alert ('Invalid column number choosen, must be between 0 and ' + (oSettings.aoColumns.length-1));
return false;
}
var oSettings = oSettings,
iColumn = iColumn,
bCaseSensitive = (typeof(bCaseSensitive) != 'boolean' ? true : bCaseSensitive);
oSettings.aoDrawCallback.push({ "fn": fakeRowspan, "sName": "fnFakeRowspan" });
function fakeRowspan () {
var firstOccurance = null,
value = null,
rowspan = 0;
jQuery.each(oSettings.aoData, function (i, oData) {
var val = oData._aData[iColumn],
cell = oData.nTr.childNodes[iColumn];
/* Use lowercase comparison if not case-sensitive. */
if (!bCaseSensitive) {
val = val.toLowerCase();
}
/* Reset values on new cell data. */
if (val != value) {
value = val;
firstOccurance = cell;
rowspan = 0;
}
if (val == value) {
rowspan++;
}
if (firstOccurance !== null && val == value && rowspan > 1) {
oData.nTr.removeChild(cell);
firstOccurance.rowSpan = rowspan;
}
});
}
return this;
};

@ -0,0 +1,26 @@
/**
* Apply the same filter to all DataTable instances on a particular page. The
* function call exactly matches that used by fnFilter() so regular expression
* and individual column sorting can be used.
* @name fnFilterAll
* @anchor fnFilterAll
* @author <a href="http://www.kmmtiming.se/">Kristoffer Karlström</a>
*
* @example
* $(document).ready(function() {
* var oTable = $(".dataTable").dataTable();
*
* $("#search").keyup( function () {
* // Filter on the column (the index) of this element
* oTable.fnFilterAll(this.value);
* } );
* });
*/
$.fn.dataTableExt.oApi.fnFilterAll = function(oSettings, sInput, iColumn, bRegex, bSmart) {
var settings = $.fn.dataTableSettings;
for ( var i=0 ; i<settings.length ; i++ ) {
settings[i].oInstance.fnFilter( sInput, iColumn, bRegex, bSmart);
}
};

@ -0,0 +1,46 @@
/**
* Remove all filtering that has been applied to a DataTable, be it column
* based filtering or global filtering.
* @name fnFilterClear
* @anchor fnFilterClear
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
*
* @example
* $(document).ready(function() {
* var oTable = $('#example').dataTable();
*
* // Perform a filter
* oTable.fnFilter('Win');
* oTable.fnFilter('Trident', 0);
*
* // Remove all filtering
* oTable.fnFilterClear();
* } );
*/
$.fn.dataTableExt.oApi.fnFilterClear = function ( oSettings )
{
/* Remove global filter */
oSettings.oPreviousSearch.sSearch = "";
/* Remove the text of the global filter in the input boxes */
if ( typeof oSettings.aanFeatures.f != 'undefined' )
{
var n = oSettings.aanFeatures.f;
for ( var i=0, iLen=n.length ; i<iLen ; i++ )
{
$('input', n[i]).val( '' );
}
}
/* Remove the search text for the column filters - NOTE - if you have input boxes for these
* filters, these will need to be reset
*/
for ( var i=0, iLen=oSettings.aoPreSearchCols.length ; i<iLen ; i++ )
{
oSettings.aoPreSearchCols[i].sSearch = "";
}
/* Redraw */
oSettings.oApi._fnReDraw( oSettings );
};

@ -0,0 +1,31 @@
/**
* This plug-in removed the default behaviour of DataTables to filter on each
* keypress, and replaces with it the requirement to press the enter key to
* perform the filter.
* @name fnFilterOnReturn
* @anchor fnFilterOnReturn
* @author <a href="http://www.mvccms.com/">Jon Ranes</a>
*
* @example
* $(document).ready(function() {
* $('.dataTable').dataTable().fnFilterOnReturn();
* } );
*/
jQuery.fn.dataTableExt.oApi.fnFilterOnReturn = function (oSettings) {
var _that = this;
this.each(function (i) {
$.fn.dataTableExt.iApiIndex = i;
var $this = this;
var anControl = $('input', _that.fnSettings().aanFeatures.f);
anControl.unbind('keyup').bind('keypress', function (e) {
if (e.which == 13) {
$.fn.dataTableExt.iApiIndex = i;
_that.fnFilter(anControl.val());
}
});
return this;
});
return this;
};

@ -0,0 +1,48 @@
/**
* Search through a table looking for a given string (optionally the search
* can be restricted to a single column). The return value is an array with
* the data indexes (from DataTables' internal data store) for any rows which
* match.
* @name fnFindCellRowIndexes
* @anchor fnFindCellRowIndexes
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
*
* @example
* $(document).ready(function() {
* var oTable = $('#example').dataTable();
*
* var a = oTable.fnFindCellRowIndexes( '1.7' ); // Search all columns
*
* var b = oTable.fnFindCellRowIndexes( '1.7', 3 ); // Search only column 3
* } );
*/
$.fn.dataTableExt.oApi.fnFindCellRowIndexes = function ( oSettings, sSearch, iColumn )
{
var
i,iLen, j, jLen,
aOut = [], aData;
for ( i=0, iLen=oSettings.aoData.length ; i<iLen ; i++ )
{
aData = oSettings.aoData[i]._aData;
if ( typeof iColumn == 'undefined' )
{
for ( j=0, jLen=aData.length ; j<jLen ; j++ )
{
if ( aData[j] == sSearch )
{
aOut.push( i );
}
}
}
else if ( aData[iColumn] == sSearch )
{
aOut.push( i );
}
}
return aOut;
};

@ -0,0 +1,47 @@
/**
* Much like fnFindCellRowIndexes this plug-in will search a table for
* matching data (optionally the search can be restricted to a single column),
* but in this case the returned array contains TR nodes of the matching rows,
* rather than data indexes.
* @name fnFindCellRowNodes
* @anchor fnFindCellRowNodes
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
*
* @example
* $(document).ready(function() {
* var oTable = $('#example').dataTable();
*
* var a = oTable.fnFindCellRowNodes( '1.7' ); // Search all columns
*
* var b = oTable.fnFindCellRowNodes( '1.7', 3 ); // Search only column 3
* } );
*/
$.fn.dataTableExt.oApi.fnFindCellRowNodes = function ( oSettings, sSearch, iColumn )
{
var
i,iLen, j, jLen,
aOut = [], aData;
for ( i=0, iLen=oSettings.aoData.length ; i<iLen ; i++ )
{
aData = oSettings.aoData[i]._aData;
if ( typeof iColumn == 'undefined' )
{
for ( j=0, jLen=aData.length ; j<jLen ; j++ )
{
if ( aData[j] == sSearch )
{
aOut.push( oSettings.aoData[i].nTr );
}
}
}
else if ( aData[iColumn] == sSearch )
{
aOut.push( oSettings.aoData[i].nTr );
}
}
return aOut;
};

@ -0,0 +1,48 @@
/**
* Due to the fact that DataTables moves DOM elements around (mainly TR
* elements for sorting and filtering) it can at times be a little tricky
* to get the next row based on another, while taking into account pagination,
* filtering, sorting etc. This function is designed to address exactly this
* situation. It takes two parameters, the target node, and a boolean
* indicating if the adjacent row retrieved should be the next (true, or no
* value) or the previous (false).
* @name fnGetAdjacentTr
* @anchor fnGetAdjacentTr
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
*
* @example
* $(document).ready(function() {
* var oTable = $('#example').dataTable();
*
* var n1 = $('#example tbody tr:eq(2)')[0];
* var nNext = oTable.fnGetAdjacentTr( n1 );
* var nPrev = oTable.fnGetAdjacentTr( n1, false );
* } );
*/
$.fn.dataTableExt.oApi.fnGetAdjacentTr = function ( oSettings, nTr, bNext )
{
/* Find the node's position in the aoData store */
var iCurrent = oSettings.oApi._fnNodeToDataIndex( oSettings, nTr );
/* Convert that to a position in the display array */
var iDisplayIndex = $.inArray( iCurrent, oSettings.aiDisplay );
if ( iDisplayIndex == -1 )
{
/* Not in the current display */
return null;
}
/* Move along the display array as needed */
iDisplayIndex += (typeof bNext=='undefined' || bNext) ? 1 : -1;
/* Check that it within bounds */
if ( iDisplayIndex < 0 || iDisplayIndex >= oSettings.aiDisplay.length )
{
/* There is no next/previous element */
return null;
}
/* Return the target node from the aoData store */
return oSettings.aoData[ oSettings.aiDisplay[ iDisplayIndex ] ].nTr;
};

@ -0,0 +1,51 @@
/**
* Return an array of table values from a particular column, with various
* filtering options.
* @name fnGetColumnData
* @anchor fnGetColumnData
* @author <a href="http://mind2.de">Benedikt Forchhammer</a>
*
* @example
*
*/
jQuery.fn.dataTableExt.oApi.fnGetColumnData = function ( oSettings, iColumn, bUnique, bFiltered, bIgnoreEmpty ) {
// check that we have a column id
if ( typeof iColumn == "undefined" ) return [];
// by default we only wany unique data
if ( typeof bUnique == "undefined" ) bUnique = true;
// by default we do want to only look at filtered data
if ( typeof bFiltered == "undefined" ) bFiltered = true;
// by default we do not wany to include empty values
if ( typeof bIgnoreEmpty == "undefined" ) bIgnoreEmpty = true;
// list of rows which we're going to loop through
var aiRows;
// use only filtered rows
if (bFiltered == true) aiRows = oSettings.aiDisplay;
// use all rows
else aiRows = oSettings.aiDisplayMaster; // all row numbers
// set up data array
var asResultData = new Array();
for (var i=0,c=aiRows.length; i<c; i++) {
iRow = aiRows[i];
var sValue = this.fnGetData(iRow, iColumn);
// ignore empty values?
if (bIgnoreEmpty == true && sValue.length == 0) continue;
// ignore unique values?
else if (bUnique == true && jQuery.inArray(sValue, asResultData) > -1) continue;
// else push the value onto the result data array
else asResultData.push(sValue);
}
return asResultData;
};

@ -0,0 +1,26 @@
/**
* Maintenance of web-sites can often cause unexpected headaches, particularly
* if the hardcoded index of an array (the columns in a DataTables instance)
* needs to change due to an added or removed column. This plug-in function
* will match a given string to the title of a column in the table and return
* the column index, helping to overcome this problem.
* @name fnGetColumnIndex
* @anchor fnGetColumnIndex
* @author <a href="http://www.rosstechassociates.com/">Michael Ross</a>
*
* @example
*
*/
$.fn.dataTableExt.oApi.fnGetColumnIndex = function ( oSettings, sCol )
{
var cols = oSettings.aoColumns;
for ( var x=0, xLen=cols.length ; x<xLen ; x++ )
{
if ( cols[x].sTitle.toLowerCase() == sCol.toLowerCase() )
{
return x;
};
}
return -1;
};

@ -0,0 +1,27 @@
/**
* Get a list of all TR nodes in the table which are not currently visible
* (useful for building forms).
* @name fnGetHiddenNodes
* @anchor fnGetHiddenNodes
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
*/
$.fn.dataTableExt.oApi.fnGetHiddenNodes = function ( oSettings )
{
/* Note the use of a DataTables 'private' function thought the 'oApi' object */
var anNodes = this.oApi._fnGetTrNodes( oSettings );
var anDisplay = $('tbody tr', oSettings.nTable);
/* Remove nodes which are being displayed */
for ( var i=0 ; i<anDisplay.length ; i++ )
{
var iIndex = jQuery.inArray( anDisplay[i], anNodes );
if ( iIndex != -1 )
{
anNodes.splice( iIndex, 1 );
}
}
/* Fire back the array to the caller */
return anNodes;
};

@ -0,0 +1,47 @@
/**
* Get a TD node from a row, taking into account column visibility. While
* getting a TD node is easy when it is visible on the page by using normal
* DOM methods, jQuery or whatever, it becomes a lot more complicated when
* taking into account hidden rows and columns. This function can be used to
* overcome these difficulties.
* @name fnColumnIndexToVisible
* @anchor fnColumnIndexToVisible
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
*
* @example
* $(document).ready(function() {
* var oTable = $('#example').dataTable();
*
* // Sort in the order that was origially in the HTML
* var nTd = oTable.fnGetTd( $('#example tbody tr:eq(1)')[0], 1 );
* console.log( nTd );
* } );
*/
$.fn.dataTableExt.oApi.fnGetTd = function ( oSettings, mTr, iTd, bVisOnly )
{
/* Take either a TR node or aoData index as the mTr property */
var iRow = (typeof mTr == 'object') ?
oSettings.oApi._fnNodeToDataIndex(oSettings, mTr) : mTr;
if ( typeof bVisOnly == 'undefined' && !bVisOnly )
{
/* Looking at both visible and hidden TD elements - convert to visible index, if not present
* then it must be hidden. Return as appropriate
*/
var iCalcVis = oSettings.oApi._fnColumnIndexToVisible( oSettings, iTd );
if ( iCalcVis !== null )
{
return oSettings.aoData[ iRow ].nTr.getElementsByTagName('td')[ iCalcVis ];
}
else
{
return oSettings.aoData[ iRow ]._anHidden[ iTd ];
}
}
else
{
/* Only looking at visible TD elements, so just use getElements... */
return oSettings.aoData[ iRow ].nTr.getElementsByTagName('td')[ iTd ];
}
};

@ -0,0 +1,55 @@
/**
* Get an array of TD nodes from DataTables for a given row, including any
* column elements which are hidden.
* @name fnGetTds
* @anchor fnGetTds
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
*
* @example
* $(document).ready(function() {
* var oTable = $('#example').dataTable();
*
* // Sort in the order that was origially in the HTML
* var anTds = oTable.fnGetTds( $('#example tbody tr:eq(1)')[0] );
* console.log( anTds );
* } );
*/
$.fn.dataTableExt.oApi.fnGetTds = function ( oSettings, mTr )
{
var anTds = [];
var anVisibleTds = [];
var iCorrector = 0;
var nTd, iColumn, iColumns;
/* Take either a TR node or aoData index as the mTr property */
var iRow = (typeof mTr == 'object') ?
oSettings.oApi._fnNodeToDataIndex(oSettings, mTr) : mTr;
var nTr = oSettings.aoData[iRow].nTr;
/* Get an array of the visible TD elements */
for ( iColumn=0, iColumns=nTr.childNodes.length ; iColumn<iColumns ; iColumn++ )
{
nTd = nTr.childNodes[iColumn];
if ( nTd.nodeName.toUpperCase() == "TD" )
{
anVisibleTds.push( nTd );
}
}
/* Construct and array of the combined elements */
for ( iColumn=0, iColumns=oSettings.aoColumns.length ; iColumn<iColumns ; iColumn++ )
{
if ( oSettings.aoColumns[iColumn].bVisible )
{
anTds.push( anVisibleTds[iColumn-iCorrector] );
}
else
{
anTds.push( oSettings.aoData[iRow]._anHidden[iColumn] );
iCorrector++;
}
}
return anTds;
};

@ -0,0 +1,41 @@
/**
* Change the number of records that can be viewed on a single page in
* DataTables.
* @name fnLengthChange
* @anchor fnLengthChange
* @author <a href="http://www.webdetails.pt/">Pedro Alves</a>
*
* @example
* $(document).ready(function() {
* var oTable = $('#example').dataTable();
* oTable.fnLengthChange( 100 );
* } );
*/
$.fn.dataTableExt.oApi.fnLengthChange = function ( oSettings, iDisplay )
{
oSettings._iDisplayLength = iDisplay;
oSettings.oApi._fnCalculateEnd( oSettings );
/* If we have space to show extra rows (backing up from the end point - then do so */
if ( oSettings._iDisplayEnd == oSettings.aiDisplay.length )
{
oSettings._iDisplayStart = oSettings._iDisplayEnd - oSettings._iDisplayLength;
if ( oSettings._iDisplayStart < 0 )
{
oSettings._iDisplayStart = 0;
}
}
if ( oSettings._iDisplayLength == -1 )
{
oSettings._iDisplayStart = 0;
}
oSettings.oApi._fnDraw( oSettings );
if ( oSettings.aanFeatures.l )
{
$('select', oSettings.aanFeatures.l).val( iDisplay );
}
};

@ -0,0 +1,43 @@
/**
* This plug-in adds to DataTables the ability to set multiple column
* filtering terms in a single call (particularly useful if using server-side
* processing). Used in combination with the column sName parameter, simply
* pass in an object with the key/value pair being the column you wish to
* search on, and the value you wish to search for.
* @name fnMultiFilter
* @anchor fnMultiFilter
* @author <i>mrkevans</i>
*
* @example
* $(document).ready(function() {
* var oTable = $('#example').dataTable( {
* "aoColumns": [
* { "sName": "engine" },
* { "sName": "browser" },
* { "sName": "platform" },
* { "sName": "version" },
* { "sName": "grade" }
* ]
* } );
* oTable.fnMultiFilter( { "engine": "Gecko", "browser": "Cam" } );
* } );
*/
$.fn.dataTableExt.oApi.fnMultiFilter = function( oSettings, oData ) {
for ( var key in oData )
{
if ( oData.hasOwnProperty(key) )
{
for ( var i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
{
if( oSettings.aoColumns[i].sName == key )
{
/* Add single column filter */
oSettings.aoPreSearchCols[ i ].sSearch = oData[key];
break;
}
}
}
}
this.oApi._fnReDraw( oSettings );
};

@ -0,0 +1,32 @@
/**
* Get information about the paging settings that DataTables is currently
* using to display each page, including the number of records shown, start
* and end points in the data set etc.
* @name fnPagingInfo
* @anchor fnPagingInfo
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
*
* @example
* $(document).ready(function() {
* $('#example').dataTable( {
* "fnDrawCallback": function () {
* alert( 'Now on page'+ this.fnPagingInfo().iPage );
* }
* } );
* } );
*/
$.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings )
{
return {
"iStart": oSettings._iDisplayStart,
"iEnd": oSettings.fnDisplayEnd(),
"iLength": oSettings._iDisplayLength,
"iTotal": oSettings.fnRecordsTotal(),
"iFilteredTotal": oSettings.fnRecordsDisplay(),
"iPage": oSettings._iDisplayLength === -1 ?
0 : Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ),
"iTotalPages": oSettings._iDisplayLength === -1 ?
0 : Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength )
};
};

@ -0,0 +1,22 @@
/**
* When doing some heavy processing of your own (for example using fnOpen with
* data loading from the server) it can be useful to make use of the
* 'processing' indicator built-into DataTables. This plug-in function
* exposes the internal DataTables function so it can be used for exactly this.
* @name fnProcessingIndicator
* @anchor fnProcessingIndicator
* @author Allan Chappell
*
* @example
* oTable.fnProcessingIndicator(); // On
* oTable.fnProcessingIndicator(false); // Off
*/
jQuery.fn.dataTableExt.oApi.fnProcessingIndicator = function ( oSettings, onoff )
{
if( typeof(onoff) == 'undefined' )
{
onoff=true;
}
this.oApi._fnProcessingDisplay( oSettings, onoff );
};

@ -0,0 +1,84 @@
/**
* By default DataTables only uses the sAjaxSource variable at initialisation
* time, however it can be useful to re-read an Ajax source and have the table
* update. Typically you would need to use the fnClearTable() and fnAddData()
* functions, however this wraps it all up in a single function call.
* @name fnReloadAjax
* @anchor fnReloadAjax
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
*
* @example
* // Example call to load a new file
* oTable.fnReloadAjax( 'media/examples_support/json_source2.txt' );
*
* // Example call to reload from original file
* oTable.fnReloadAjax();
*/
$.fn.dataTableExt.oApi.fnReloadAjax = function ( oSettings, sNewSource, fnCallback, bStandingRedraw )
{
// DataTables 1.10 compatibility - if 1.10 then `versionCheck` exists.
// 1.10's API has ajax reloading built in, so we use those abilities
// directly.
if ( $.fn.dataTable.versionCheck ) {
var api = new $.fn.dataTable.Api( oSettings );
if ( sNewSource ) {
api.ajax.url( sNewSource ).load( fnCallback, !bStandingRedraw );
}
else {
api.ajax.reload( fnCallback, !bStandingRedraw );
}
return;
}
if ( sNewSource !== undefined && sNewSource !== null ) {
oSettings.sAjaxSource = sNewSource;
}
// Server-side processing should just call fnDraw
if ( oSettings.oFeatures.bServerSide ) {
this.fnDraw();
return;
}
this.oApi._fnProcessingDisplay( oSettings, true );
var that = this;
var iStart = oSettings._iDisplayStart;
var aData = [];
this.oApi._fnServerParams( oSettings, aData );
oSettings.fnServerData.call( oSettings.oInstance, oSettings.sAjaxSource, aData, function(json) {
/* Clear the old information from the table */
that.oApi._fnClearTable( oSettings );
/* Got the data - add it to the table */
var aData = (oSettings.sAjaxDataProp !== "") ?
that.oApi._fnGetObjectDataFn( oSettings.sAjaxDataProp )( json ) : json;
for ( var i=0 ; i<aData.length ; i++ )
{
that.oApi._fnAddData( oSettings, aData[i] );
}
oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
that.fnDraw();
if ( bStandingRedraw === true )
{
oSettings._iDisplayStart = iStart;
that.oApi._fnCalculateEnd( oSettings );
that.fnDraw( false );
}
that.oApi._fnProcessingDisplay( oSettings, false );
/* Callback user function - for event handlers etc */
if ( typeof fnCallback == 'function' && fnCallback !== null )
{
fnCallback( oSettings );
}
}, oSettings );
};

@ -0,0 +1,45 @@
/**
* Enables filtration delay for keeping the browser more responsive while
* searching for a longer keyword.
* @name fnSetFilteringDelay
* @anchor fnSetFilteringDelay
* @author <a href="http://www.zygimantas.com/">Zygimantas Berziunas</a>, <a href="http://www.sprymedia.co.uk/">Allan Jardine</a> and <i>vex</i>
*
* @example
* $(document).ready(function() {
* $('.dataTable').dataTable().fnSetFilteringDelay();
* } );
*/
jQuery.fn.dataTableExt.oApi.fnSetFilteringDelay = function ( oSettings, iDelay ) {
var _that = this;
if ( iDelay === undefined ) {
iDelay = 250;
}
this.each( function ( i ) {
$.fn.dataTableExt.iApiIndex = i;
var
$this = this,
oTimerId = null,
sPreviousSearch = null,
anControl = $( 'input', _that.fnSettings().aanFeatures.f );
anControl.unbind( 'keyup' ).bind( 'keyup', function() {
var $$this = $this;
if (sPreviousSearch === null || sPreviousSearch != anControl.val()) {
window.clearTimeout(oTimerId);
sPreviousSearch = anControl.val();
oTimerId = window.setTimeout(function() {
$.fn.dataTableExt.iApiIndex = i;
_that.fnFilter( anControl.val() );
}, iDelay);
}
});
return this;
} );
return this;
};

@ -0,0 +1,36 @@
/**
* This function will restore the order in which data was read into a
* DataTable (for example from an HTML source). Although you can set
* aaSorting to be an empty array ([ ]) in order to prevent sorting during
* initialisation, it can sometimes be useful to restore the original order
* after sorting has already occurred - which is exactly what this function
* does.
* @name fnSortNeutral
* @anchor fnSortNeutral
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
*
* @example
* $(document).ready(function() {
* var oTable = $('#example').dataTable();
*
* // Sort in the order that was originally in the HTML
* oTable.fnSortNeutral();
* } );
*/
$.fn.dataTableExt.oApi.fnSortNeutral = function ( oSettings )
{
/* Remove any current sorting */
oSettings.aaSorting = [];
/* Sort display arrays so we get them in numerical order */
oSettings.aiDisplay.sort( function (x,y) {
return x-y;
} );
oSettings.aiDisplayMaster.sort( function (x,y) {
return x-y;
} );
/* Redraw */
oSettings.oApi._fnReDraw( oSettings );
};

@ -0,0 +1,28 @@
/**
* Redraw the table (i.e. fnDraw) to take account of sorting and filtering,
* but retain the current pagination settings.
* @name fnStandingRedraw
* @anchor fnStandingRedraw
* @author Jonathan Hoguet
*
* @example
* $(document).ready(function() {
* var oTable = $('.dataTable').dataTable()
* oTable.fnStandingRedraw();
* } );
*/
$.fn.dataTableExt.oApi.fnStandingRedraw = function(oSettings) {
if(oSettings.oFeatures.bServerSide === false){
var before = oSettings._iDisplayStart;
oSettings.oApi._fnReDraw(oSettings);
// iDisplayStart has been reset to zero - so lets change it back
oSettings._iDisplayStart = before;
oSettings.oApi._fnCalculateEnd(oSettings);
}
// draw the 'current' page
oSettings.oApi._fnDraw(oSettings);
};

@ -0,0 +1,17 @@
/**
* When DataTables removes columns from the display (bVisible or
* fnSetColumnVis) it removes these elements from the DOM, effecting the index
* value for the column positions. This function converts the visible column
* index into a data column index (i.e. all columns regardless of visibility).
* @name fnVisibleToColumnIndex
* @anchor fnVisibleToColumnIndex
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
*
* @example
*
*/
$.fn.dataTableExt.oApi.fnVisibleToColumnIndex = function ( oSettings, iMatch )
{
return oSettings.oApi._fnVisibleToColumnIndex( oSettings, iMatch );
};

@ -0,0 +1,36 @@
<h2>Custom API functions</h2>
<p>One of the most common interactions with DataTables for a developer (other than initialisation of the table of course!) is to make use of the <a href="/api">API functions</a> provided by DataTables. While allowing for a fairly extensive range of code interactions, the default API set can be greatly enhanced by making use of the functions provided below, as suitable for your application.</p>
<ul>
<li><a href="#how_to">How to use DataTables plug-in API functions</a></li>
<li><a href="#functions">Plug-in API functions</a></li>
</ul>
<a name="how_to"></a>
<h3>How to use DataTables plug-in API functions</h3>
<p>To make use of one of the plug-in API functions below, you simply need to include it in the Javascript available for your page, after you load the DataTables library, but before you initialise the DataTable. After that, you will be able to initialise the table, and call the function on the resulting object. As an example the code below makes use of <a href="#fnGetHiddenNodes">fnGetHiddenNodes</a> saved into a file (<a href="/examples/plug-ins/plugin_api.html">live example</a>):</p>
<pre class="brush: html">&lt;script type="text/javascript" src="jquery.dataTables.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="dataTables.fnGetHiddenNodes.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
$(document).ready(function() {
var oTable = $('#example').dataTable();
$('#button').click( function () {
var nHidden = oTable.fnGetHiddenNodes();
alert( nHidden.length +' nodes were returned' );
} );
} );
&lt;/script&gt;
</pre>
<p>Please note that DataTables will automatically pass the settings object as the first parameter. As such, you do not need to pass the settings object, which you will see if you look at the plug-in API's code.</p>
<a name="functions"></a>
<h3>Plug-in API functions</h3>
include(`build.1.inc')

@ -1,8 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
declare module 'datatables.net' {
interface ApiOrder {
/** Change ordering of the table to its data load order */
neutral(): Api<any>;
}
}
export {};

@ -1,84 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window === 'undefined') {
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.document );
}
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* This function will restore the order in which data was read into a DataTable
* (for example from an HTML source). Although you can set `dt-api order()` to
* be an empty array (`[]`) in order to prevent sorting during initialisation,
* it can sometimes be useful to restore the original order after sorting has
* already occurred - which is exactly what this function does.
*
* Please note that this plug-in can only be used for client-side processing
* tables (i.e. without `serverSide: true`).
*
* @name order.neutral()
* @summary Change ordering of the table to its data load order
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @returns {DataTables.Api} DataTables API instance
*
* @example
* // Return table to the loaded data order
* table.order.neutral().draw();
*/
DataTable.Api.register('order.neutral()', function () {
return this.iterator('table', function (s) {
s.aaSorting.length = 0;
s.aiDisplay.sort(function (a, b) {
return a - b;
});
s.aiDisplayMaster.sort(function (a, b) {
return a - b;
});
});
});
return DataTable;
}));

@ -1,2 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(t){var o,r;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?(o=require("jquery"),r=function(e,n){n.fn.dataTable||require("datatables.net")(e,n)},"undefined"==typeof window?module.exports=function(e,n){return e=e||window,n=n||o(e),r(e,n),t(n,0,e.document)}:(r(window,o),module.exports=t(o,window,window.document))):t(jQuery,window,document)}(function(e,n,t,o){"use strict";e=e.fn.dataTable;return e.Api.register("order.neutral()",function(){return this.iterator("table",function(e){e.aaSorting.length=0,e.aiDisplay.sort(function(e,n){return e-n}),e.aiDisplayMaster.sort(function(e,n){return e-n})})}),e});

@ -1,2 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;DataTable.Api.register("order.neutral()",function(){return this.iterator("table",function(t){t.aaSorting.length=0,t.aiDisplay.sort(function(t,r){return t-r}),t.aiDisplayMaster.sort(function(t,r){return t-r})})});export default DataTable;

@ -1,43 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
import jQuery from 'jquery';
import DataTable from 'datatables.net';
// Allow reassignment of the $ variable
let $ = jQuery;
/**
* This function will restore the order in which data was read into a DataTable
* (for example from an HTML source). Although you can set `dt-api order()` to
* be an empty array (`[]`) in order to prevent sorting during initialisation,
* it can sometimes be useful to restore the original order after sorting has
* already occurred - which is exactly what this function does.
*
* Please note that this plug-in can only be used for client-side processing
* tables (i.e. without `serverSide: true`).
*
* @name order.neutral()
* @summary Change ordering of the table to its data load order
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @returns {DataTables.Api} DataTables API instance
*
* @example
* // Return table to the loaded data order
* table.order.neutral().draw();
*/
DataTable.Api.register('order.neutral()', function () {
return this.iterator('table', function (s) {
s.aaSorting.length = 0;
s.aiDisplay.sort(function (a, b) {
return a - b;
});
s.aiDisplayMaster.sort(function (a, b) {
return a - b;
});
});
});
export default DataTable;

@ -1,8 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
declare module 'datatables.net' {
interface ApiPage {
/** Change ordering of the table to its data load order */
jumpToData(data: any): Api<any>;
}
}
export {};

@ -1,87 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window === 'undefined') {
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.document );
}
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* It can be quite useful to jump straight to a page which contains a certain
* piece of data (a user name for example). This plug-in provides exactly that
* ability, searching for a given data parameter from a given column and
* immediately shifting the paging of the table to jump to that point.
*
* If multiple data points match the requested data, the paging will be shifted
* to show the first instance. If there are no matches, the paging will not
* change.
*
* Note that unlike the core DataTables API methods, this plug-in will
* automatically call `dt-api draw()` to redraw the table with the current page
* shown.
*
* @name page.JumpToData()
* @summary Jump to a page by searching for data from a column
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @param {*} data Data to search for
* @param {integer} column Column index
* @returns {Api} DataTables API instance
*
* @example
* var table = $('#example').DataTable();
* table.page.jumpToData( "Allan Jardine", 0 );
*/
DataTable.Api.register('page.jumpToData()', function (data, column) {
var pos = this.column(column, { order: 'current' }).data().indexOf(data);
if (pos >= 0) {
var page = Math.floor(pos / this.page.info().length);
this.page(page).draw(false);
}
return this;
});
return DataTable;
}));

@ -1,2 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(t){var o,i;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?(o=require("jquery"),i=function(e,n){n.fn.dataTable||require("datatables.net")(e,n)},"undefined"==typeof window?module.exports=function(e,n){return e=e||window,n=n||o(e),i(e,n),t(n,0,e.document)}:(i(window,o),module.exports=t(o,window,window.document))):t(jQuery,window,document)}(function(e,n,t,o){"use strict";e=e.fn.dataTable;return e.Api.register("page.jumpToData()",function(e,n){n=this.column(n,{order:"current"}).data().indexOf(e);return 0<=n&&(e=Math.floor(n/this.page.info().length),this.page(e).draw(!1)),this}),e});

@ -1,2 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;DataTable.Api.register("page.jumpToData()",function(t,a){a=this.column(a,{order:"current"}).data().indexOf(t);return 0<=a&&(t=Math.floor(a/this.page.info().length),this.page(t).draw(!1)),this});export default DataTable;

@ -1,46 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
import jQuery from 'jquery';
import DataTable from 'datatables.net';
// Allow reassignment of the $ variable
let $ = jQuery;
/**
* It can be quite useful to jump straight to a page which contains a certain
* piece of data (a user name for example). This plug-in provides exactly that
* ability, searching for a given data parameter from a given column and
* immediately shifting the paging of the table to jump to that point.
*
* If multiple data points match the requested data, the paging will be shifted
* to show the first instance. If there are no matches, the paging will not
* change.
*
* Note that unlike the core DataTables API methods, this plug-in will
* automatically call `dt-api draw()` to redraw the table with the current page
* shown.
*
* @name page.JumpToData()
* @summary Jump to a page by searching for data from a column
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @param {*} data Data to search for
* @param {integer} column Column index
* @returns {Api} DataTables API instance
*
* @example
* var table = $('#example').DataTable();
* table.page.jumpToData( "Allan Jardine", 0 );
*/
DataTable.Api.register('page.jumpToData()', function (data, column) {
var pos = this.column(column, { order: 'current' }).data().indexOf(data);
if (pos >= 0) {
var page = Math.floor(pos / this.page.info().length);
this.page(page).draw(false);
}
return this;
});
export default DataTable;

@ -1,8 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
declare module 'datatables.net' {
interface Api<T> {
/** Show / hide the processing indicator. */
processing(boolean: any): Api<T>;
}
}
export {};

@ -1,84 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window === 'undefined') {
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.document );
}
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* Externally trigger the display of DataTables' "processing" indicator.
*
* Please note that of DataTables 2.0.0 this functionality is now built into
* DataTables core and this plug-in is no longer required.
*
* @name processing()
* @summary Show / hide the processing indicator via the API
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
* @param {boolean} show `true` to show the processing indicator, `false` to
* hide it.
*
* @returns {DataTables.Api} Unmodified API instance
*
* @example
* // Show a processing indicator for two seconds on initialisation
* var table = $('#example').DataTable( {
* processing: true
* } );
*
* table.processing( true );
*
* setTimeout( function () {
* table.processing( false );
* }, 2000 );
*/
DataTable.Api.register('processing()', function (show) {
return this.iterator('table', function (ctx) {
ctx.oApi._fnProcessingDisplay(ctx, show);
});
});
return DataTable;
}));

@ -1,2 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(t){var o,i;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?(o=require("jquery"),i=function(e,n){n.fn.dataTable||require("datatables.net")(e,n)},"undefined"==typeof window?module.exports=function(e,n){return e=e||window,n=n||o(e),i(e,n),t(n,0,e.document)}:(i(window,o),module.exports=t(o,window,window.document))):t(jQuery,window,document)}(function(e,n,t,o){"use strict";e=e.fn.dataTable;return e.Api.register("processing()",function(n){return this.iterator("table",function(e){e.oApi._fnProcessingDisplay(e,n)})}),e});

@ -1,2 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;DataTable.Api.register("processing()",function(e){return this.iterator("table",function(t){t.oApi._fnProcessingDisplay(t,e)})});export default DataTable;

@ -1,43 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
import jQuery from 'jquery';
import DataTable from 'datatables.net';
// Allow reassignment of the $ variable
let $ = jQuery;
/**
* Externally trigger the display of DataTables' "processing" indicator.
*
* Please note that of DataTables 2.0.0 this functionality is now built into
* DataTables core and this plug-in is no longer required.
*
* @name processing()
* @summary Show / hide the processing indicator via the API
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
* @param {boolean} show `true` to show the processing indicator, `false` to
* hide it.
*
* @returns {DataTables.Api} Unmodified API instance
*
* @example
* // Show a processing indicator for two seconds on initialisation
* var table = $('#example').DataTable( {
* processing: true
* } );
*
* table.processing( true );
*
* setTimeout( function () {
* table.processing( false );
* }, 2000 );
*/
DataTable.Api.register('processing()', function (show) {
return this.iterator('table', function (ctx) {
ctx.oApi._fnProcessingDisplay(ctx, show);
});
});
export default DataTable;

@ -1,8 +0,0 @@
/*! © Edouard Labre - datatables.net/license */
declare module 'datatables.net' {
interface ApiRowMethods<T> {
/** See the row in datable by display the right pagination page */
show(): Api<T>;
}
}
export {};

@ -1,95 +0,0 @@
/*! © Edouard Labre - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window === 'undefined') {
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.document );
}
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* This plugin jumps to the right page of the DataTable to show the required row
*
* @version 1.0
* @name row().show()
* @summary See the row in datable by display the right pagination page
* @author [Edouard Labre](http://www.edouardlabre.com)
*
* @param {void} a row must be selected
* @returns {DataTables.Api.Rows} DataTables Rows API instance
*
* @example
* // Add an element to a huge table and go to the right pagination page
* var table = $('#example').DataTable();
* var new_row = {
* DT_RowId: 'row_example',
* name: 'example',
* value: 'an example row'
* };
*
* table.row.add( new_row ).draw().show().draw(false);
*/
DataTable.Api.register('row().show()', function () {
var page_info = this.table().page.info();
// Get row index
var new_row_index = this.index();
// Row position
var row_position = this.table()
.rows({ search: 'applied' })[0]
.indexOf(new_row_index);
// Already on right page ?
if ((row_position >= page_info.start && row_position < page_info.end) ||
row_position < 0) {
// Return row object
return this;
}
// Find page number
var page_to_display = Math.floor(row_position / this.table().page.len());
// Go to that page
this.table().page(page_to_display);
// Return row object
return this;
});
return DataTable;
}));

@ -1,2 +0,0 @@
/*! © Edouard Labre - datatables.net/license */
!function(n){var i,o;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return n(e,window,document)}):"object"==typeof exports?(i=require("jquery"),o=function(e,t){t.fn.dataTable||require("datatables.net")(e,t)},"undefined"==typeof window?module.exports=function(e,t){return e=e||window,t=t||i(e),o(e,t),n(t,0,e.document)}:(o(window,i),module.exports=n(i,window,window.document))):n(jQuery,window,document)}(function(e,t,n,i){"use strict";e=e.fn.dataTable;return e.Api.register("row().show()",function(){var e=this.table().page.info(),t=this.index(),t=this.table().rows({search:"applied"})[0].indexOf(t);return t>=e.start&&t<e.end||t<0||(e=Math.floor(t/this.table().page.len()),this.table().page(e)),this}),e});

@ -1,2 +0,0 @@
/*! © Edouard Labre - datatables.net/license */
import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;DataTable.Api.register("row().show()",function(){var e=this.table().page.info(),t=this.index(),t=this.table().rows({search:"applied"})[0].indexOf(t);return t>=e.start&&t<e.end||t<0||(e=Math.floor(t/this.table().page.len()),this.table().page(e)),this});export default DataTable;

@ -1,54 +0,0 @@
/*! © Edouard Labre - datatables.net/license */
import jQuery from 'jquery';
import DataTable from 'datatables.net';
// Allow reassignment of the $ variable
let $ = jQuery;
/**
* This plugin jumps to the right page of the DataTable to show the required row
*
* @version 1.0
* @name row().show()
* @summary See the row in datable by display the right pagination page
* @author [Edouard Labre](http://www.edouardlabre.com)
*
* @param {void} a row must be selected
* @returns {DataTables.Api.Rows} DataTables Rows API instance
*
* @example
* // Add an element to a huge table and go to the right pagination page
* var table = $('#example').DataTable();
* var new_row = {
* DT_RowId: 'row_example',
* name: 'example',
* value: 'an example row'
* };
*
* table.row.add( new_row ).draw().show().draw(false);
*/
DataTable.Api.register('row().show()', function () {
var page_info = this.table().page.info();
// Get row index
var new_row_index = this.index();
// Row position
var row_position = this.table()
.rows({ search: 'applied' })[0]
.indexOf(new_row_index);
// Already on right page ?
if ((row_position >= page_info.start && row_position < page_info.end) ||
row_position < 0) {
// Return row object
return this;
}
// Find page number
var page_to_display = Math.floor(row_position / this.table().page.len());
// Go to that page
this.table().page(page_to_display);
// Return row object
return this;
});
export default DataTable;

@ -1,8 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
declare module 'datatables.net' {
interface ApiRowsMethods<T> {
/** Create tr elements for rows which have not yet had their nodes created. */
generate(): Api<T>;
}
}
export {};

@ -1,73 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window === 'undefined') {
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.document );
}
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* When using `-init deferRender` you might find that under a specific set of circumstances you
* need the `-tag tr` element for a row which hasn't yet been drawn. This method can be used to
* create the nodes for the rows which haven't yet been drawn.
*
* @name rows().generate()
* @summary Create tr elements for rows which have not yet had their nodes created.
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @returns {DataTable.Api} DataTables API instance
*
* @example
* // Create nodes for all rows
* table.rows().generate();
*/
DataTable.Api.register('rows().generate()', function () {
return this.iterator('row', function (context, index) {
context.oApi._fnCreateTr(context, index);
});
});
return DataTable;
}));

@ -1,2 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(t){var o,r;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?(o=require("jquery"),r=function(e,n){n.fn.dataTable||require("datatables.net")(e,n)},"undefined"==typeof window?module.exports=function(e,n){return e=e||window,n=n||o(e),r(e,n),t(n,0,e.document)}:(r(window,o),module.exports=t(o,window,window.document))):t(jQuery,window,document)}(function(e,n,t,o){"use strict";e=e.fn.dataTable;return e.Api.register("rows().generate()",function(){return this.iterator("row",function(e,n){e.oApi._fnCreateTr(e,n)})}),e});

@ -1,2 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;DataTable.Api.register("rows().generate()",function(){return this.iterator("row",function(e,t){e.oApi._fnCreateTr(e,t)})});export default DataTable;

@ -1,32 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
import jQuery from 'jquery';
import DataTable from 'datatables.net';
// Allow reassignment of the $ variable
let $ = jQuery;
/**
* When using `-init deferRender` you might find that under a specific set of circumstances you
* need the `-tag tr` element for a row which hasn't yet been drawn. This method can be used to
* create the nodes for the rows which haven't yet been drawn.
*
* @name rows().generate()
* @summary Create tr elements for rows which have not yet had their nodes created.
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @returns {DataTable.Api} DataTables API instance
*
* @example
* // Create nodes for all rows
* table.rows().generate();
*/
DataTable.Api.register('rows().generate()', function () {
return this.iterator('row', function (context, index) {
context.oApi._fnCreateTr(context, index);
});
});
export default DataTable;

@ -1,42 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
/**
* It can sometimes be useful to get the average of data in an API result set,
* be it from a column, or a collection of cells. This method provides exactly
* that ability.
*
* @name average()
* @summary Average the values in a data set.
* @author [Allan Jardine](http://sprymedia.co.uk)
* @requires DataTables 1.10+
*
* @returns {Number} Calculated average
*
* @example
* // Average a column
* var table = $('#example').DataTable();
* table.column( 3 ).data().average();
*
* @example
* // Average two cells
* var table = $('#example').DataTable();
* table.cells( 0, [3,4] ).data().average();
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface Api<T> {
/** Average the values in a data set. */
average(): Number;
}
}
DataTable.Api.register<Number>('average()', function () {
var data = this.flatten();
var sum = data.reduce(function (a, b) {
return a * 1 + b * 1; // cast values in-case they are strings
}, 0);
return sum / data.length;
});

@ -1,46 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
/**
* The plug-in provides a way to determine the searchable state of one or more
* columns, as was configured by the `-init columns.searchable` option.
*
* @name columns().order()
* @summary Apply multi-column ordering through the columns() API method.
* @author [Allan Jardine](http://sprymedia.co.uk)
* @requires DataTables 1.10+
*
* @returns {boolean|DataTables.Api} Searchable flag
*
* @example
* // Get the searchable flag for all columns
* table.columns().searchable().toArray()
*
* @example
* // Get the searchable flag for column index 0
* table.column(0).searchable()
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface ApiColumnMethods {
/** Get searchable flag for selected column */
searchable(): boolean;
}
interface ApiColumnsMethods {
/** Get searchable flag for selected columns */
searchable(): Api<boolean>;
}
}
DataTable.Api.registerPlural(
'columns().searchable()',
'column().searchable()',
function ( selector, opts ) {
return this.iterator( 'column', function ( settings, column ) {
return settings.aoColumns[column].bSearchable;
}, 1 );
}
);

@ -1,32 +0,0 @@
/*! © Alejandro Navarro - datatables.net/license */
/**
* This plug-in will read the text from the header cell of a column, returning
* that value.
*
* @name column().title()
* @summary Get the title of a column
* @author Alejandro Navarro
* @requires DataTables 1.10+
*
* @returns {String} Column title
*
* @example
* // Read the title text of column index 3
* var table = $('#example').DataTable();
* table.column( 3 ).title();
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface ApiColumnMethods {
/** Get the title of a column */
title(): string;
}
}
DataTable.Api.register('column().title()', function () {
var title = this.header();
return $(title).text().trim();
});

@ -1,57 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
/**
* The DataTables core library provides the ability to set the ordering via the
* `dt-api column().order()` method, but there is no plural equivalent. While
* multi-column ordering can be set using `dt-api order()` that method requires
* that column indexes be used.
*
* This plug-in provides the plural `columns().order()` method so you can set
* multi-column ordering, while retaining the benefits of the `dt-api columns()`
* selector options.
*
* @name columns().order()
* @summary Apply multi-column ordering through the columns() API method.
* @author [Allan Jardine](http://sprymedia.co.uk)
* @requires DataTables 1.10+
* @param {string|array} dir The order to apply to the columns selected. This
* can be a string (`asc` or `desc`) which will be applied to all columns,
* or an array (again `asc` or `desc` as the elements in the array) which is
* the same length as the number of columns selected, and will be applied to
* the columns in sequence.
*
* @returns {DataTables.Api} DataTables API instance
*
* @example
* // Apply multi-column sorting with a common direction
* table.columns( [ 1, 2 ] ).order( 'desc' ).draw();
*
* @example
* // Multi-column sorting with individual direction for the columns
* table.columns( [ 1, 2 ] ).order( [ 'desc', 'asc' ] ).draw();
*
* @example
* // Multi-column sorting based on a name selector
* table.columns( [ 'sign_up_date:name', 'user_name:name' ] ).order( 'desc' ).draw();
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface ApiColumnsMethods {
/** pply multi-column ordering through the columns() */
order(dir: 'asc' | 'desc'): Api<any>;
}
}
DataTable.Api.register('columns().order()', function (dir) {
return this.iterator('columns', function (settings, columns) {
var a: [number, string][] = [];
for (var i = 0, ien = columns.length; i < ien; i++) {
a.push([columns[i], Array.isArray(dir) ? dir[i] : dir]);
}
new DataTable.Api(settings).order(a);
});
});

@ -1,44 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
/**
* This function will restore the order in which data was read into a DataTable
* (for example from an HTML source). Although you can set `dt-api order()` to
* be an empty array (`[]`) in order to prevent sorting during initialisation,
* it can sometimes be useful to restore the original order after sorting has
* already occurred - which is exactly what this function does.
*
* Please note that this plug-in can only be used for client-side processing
* tables (i.e. without `serverSide: true`).
*
* @name order.neutral()
* @summary Change ordering of the table to its data load order
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @returns {DataTables.Api} DataTables API instance
*
* @example
* // Return table to the loaded data order
* table.order.neutral().draw();
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface ApiOrder {
/** Change ordering of the table to its data load order */
neutral(): Api<any>;
}
}
DataTable.Api.register('order.neutral()', function () {
return this.iterator('table', function (s) {
s.aaSorting.length = 0;
s.aiDisplay.sort(function (a, b) {
return a - b;
});
s.aiDisplayMaster.sort(function (a, b) {
return a - b;
});
});
});

@ -1,49 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
/**
* It can be quite useful to jump straight to a page which contains a certain
* piece of data (a user name for example). This plug-in provides exactly that
* ability, searching for a given data parameter from a given column and
* immediately shifting the paging of the table to jump to that point.
*
* If multiple data points match the requested data, the paging will be shifted
* to show the first instance. If there are no matches, the paging will not
* change.
*
* Note that unlike the core DataTables API methods, this plug-in will
* automatically call `dt-api draw()` to redraw the table with the current page
* shown.
*
* @name page.JumpToData()
* @summary Jump to a page by searching for data from a column
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @param {*} data Data to search for
* @param {integer} column Column index
* @returns {Api} DataTables API instance
*
* @example
* var table = $('#example').DataTable();
* table.page.jumpToData( "Allan Jardine", 0 );
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface ApiPage {
/** Change ordering of the table to its data load order */
jumpToData(data: any): Api<any>;
}
}
DataTable.Api.register('page.jumpToData()', function (data, column) {
var pos = this.column(column, { order: 'current' }).data().indexOf(data);
if (pos >= 0) {
var page = Math.floor(pos / this.page.info().length);
this.page(page).draw(false);
}
return this;
});

@ -1,44 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
/**
* Externally trigger the display of DataTables' "processing" indicator.
*
* Please note that of DataTables 2.0.0 this functionality is now built into
* DataTables core and this plug-in is no longer required.
*
* @name processing()
* @summary Show / hide the processing indicator via the API
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
* @param {boolean} show `true` to show the processing indicator, `false` to
* hide it.
*
* @returns {DataTables.Api} Unmodified API instance
*
* @example
* // Show a processing indicator for two seconds on initialisation
* var table = $('#example').DataTable( {
* processing: true
* } );
*
* table.processing( true );
*
* setTimeout( function () {
* table.processing( false );
* }, 2000 );
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface Api<T> {
/** Show / hide the processing indicator. */
processing(boolean): Api<T>;
}
}
DataTable.Api.register('processing()', function (show) {
return this.iterator('table', function (ctx) {
ctx.oApi._fnProcessingDisplay(ctx, show);
});
});

@ -1,60 +0,0 @@
/*! © Edouard Labre - datatables.net/license */
/**
* This plugin jumps to the right page of the DataTable to show the required row
*
* @version 1.0
* @name row().show()
* @summary See the row in datable by display the right pagination page
* @author [Edouard Labre](http://www.edouardlabre.com)
*
* @param {void} a row must be selected
* @returns {DataTables.Api.Rows} DataTables Rows API instance
*
* @example
* // Add an element to a huge table and go to the right pagination page
* var table = $('#example').DataTable();
* var new_row = {
* DT_RowId: 'row_example',
* name: 'example',
* value: 'an example row'
* };
*
* table.row.add( new_row ).draw().show().draw(false);
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface ApiRowMethods<T> {
/** See the row in datable by display the right pagination page */
show(): Api<T>;
}
}
DataTable.Api.register('row().show()', function () {
var page_info = this.table().page.info();
// Get row index
var new_row_index = this.index();
// Row position
var row_position = this.table()
.rows({ search: 'applied' })[0]
.indexOf(new_row_index);
// Already on right page ?
if (
(row_position >= page_info.start && row_position < page_info.end) ||
row_position < 0
) {
// Return row object
return this;
}
// Find page number
var page_to_display = Math.floor(row_position / this.table().page.len());
// Go to that page
this.table().page(page_to_display);
// Return row object
return this;
});

@ -1,33 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
/**
* When using `-init deferRender` you might find that under a specific set of circumstances you
* need the `-tag tr` element for a row which hasn't yet been drawn. This method can be used to
* create the nodes for the rows which haven't yet been drawn.
*
* @name rows().generate()
* @summary Create tr elements for rows which have not yet had their nodes created.
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @returns {DataTable.Api} DataTables API instance
*
* @example
* // Create nodes for all rows
* table.rows().generate();
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface ApiRowsMethods<T> {
/** Create tr elements for rows which have not yet had their nodes created. */
generate(): Api<T>;
}
}
DataTable.Api.register('rows().generate()', function () {
return this.iterator('row', function (context, index) {
context.oApi._fnCreateTr(context, index);
});
});

@ -1,61 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
/**
* Fairly simply, this plug-in will take the data from an API result set
* and sum it, returning the summed value. The data can come from any data
* source, including column data, cells or rows.
*
* Note that it will attempt to 'deformat' any string based data that is passed
* into it - i.e. it will strip any non-numeric characters in order to make a
* best effort attempt to sum all data types. This can be useful when working
* with formatting numbers such as currency. However the trade-off is that no
* error is thrown if non-numeric data is passed in. You should be aware of this
* in case unexpected values are returned - likely the input data is not what is
* expected.
*
* @name sum()
* @summary Sum the values in a data set.
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @returns {Number} Summed value
*
* @example
* // Simply get the sum of a column
* var table = $('#example').DataTable();
* table.column( 3 ).data().sum();
*
* @example
* // Insert the sum of a column into the columns footer, for the visible
* // data on each draw
* $('#example').DataTable( {
* drawCallback: function () {
* var api = this.api();
* $( api.table().footer() ).html(
* api.column( 4, {page:'current'} ).data().sum()
* );
* }
* } );
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface Api<T> {
/** Sum the values in a data set. */
sum(): Number;
}
}
DataTable.Api.register('sum()', function () {
return this.flatten().reduce(function (a, b) {
if (typeof a === 'string') {
a = (a.replace(/[^\d.-]/g, '') as any) * 1;
}
if (typeof b === 'string') {
b = (b.replace(/[^\d.-]/g, '') as any) * 1;
}
return a + b;
}, 0);
});

8
api/sum().d.ts vendored

@ -1,8 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
declare module 'datatables.net' {
interface Api<T> {
/** Sum the values in a data set. */
sum(): Number;
}
}
export {};

@ -1,100 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window === 'undefined') {
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.document );
}
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* Fairly simply, this plug-in will take the data from an API result set
* and sum it, returning the summed value. The data can come from any data
* source, including column data, cells or rows.
*
* Note that it will attempt to 'deformat' any string based data that is passed
* into it - i.e. it will strip any non-numeric characters in order to make a
* best effort attempt to sum all data types. This can be useful when working
* with formatting numbers such as currency. However the trade-off is that no
* error is thrown if non-numeric data is passed in. You should be aware of this
* in case unexpected values are returned - likely the input data is not what is
* expected.
*
* @name sum()
* @summary Sum the values in a data set.
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @returns {Number} Summed value
*
* @example
* // Simply get the sum of a column
* var table = $('#example').DataTable();
* table.column( 3 ).data().sum();
*
* @example
* // Insert the sum of a column into the columns footer, for the visible
* // data on each draw
* $('#example').DataTable( {
* drawCallback: function () {
* var api = this.api();
* $( api.table().footer() ).html(
* api.column( 4, {page:'current'} ).data().sum()
* );
* }
* } );
*/
DataTable.Api.register('sum()', function () {
return this.flatten().reduce(function (a, b) {
if (typeof a === 'string') {
a = a.replace(/[^\d.-]/g, '') * 1;
}
if (typeof b === 'string') {
b = b.replace(/[^\d.-]/g, '') * 1;
}
return a + b;
}, 0);
});
return DataTable;
}));

2
api/sum().min.js vendored

@ -1,2 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(t){var o,r;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?(o=require("jquery"),r=function(e,n){n.fn.dataTable||require("datatables.net")(e,n)},"undefined"==typeof window?module.exports=function(e,n){return e=e||window,n=n||o(e),r(e,n),t(n,0,e.document)}:(r(window,o),module.exports=t(o,window,window.document))):t(jQuery,window,document)}(function(e,n,t,o){"use strict";e=e.fn.dataTable;return e.Api.register("sum()",function(){return this.flatten().reduce(function(e,n){return(e="string"==typeof e?+e.replace(/[^\d.-]/g,""):e)+(n="string"==typeof n?+n.replace(/[^\d.-]/g,""):n)},0)}),e});

@ -1,2 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;DataTable.Api.register("sum()",function(){return this.flatten().reduce(function(e,t){return(e="string"==typeof e?+e.replace(/[^\d.-]/g,""):e)+(t="string"==typeof t?+t.replace(/[^\d.-]/g,""):t)},0)});export default DataTable;

@ -1,59 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
import jQuery from 'jquery';
import DataTable from 'datatables.net';
// Allow reassignment of the $ variable
let $ = jQuery;
/**
* Fairly simply, this plug-in will take the data from an API result set
* and sum it, returning the summed value. The data can come from any data
* source, including column data, cells or rows.
*
* Note that it will attempt to 'deformat' any string based data that is passed
* into it - i.e. it will strip any non-numeric characters in order to make a
* best effort attempt to sum all data types. This can be useful when working
* with formatting numbers such as currency. However the trade-off is that no
* error is thrown if non-numeric data is passed in. You should be aware of this
* in case unexpected values are returned - likely the input data is not what is
* expected.
*
* @name sum()
* @summary Sum the values in a data set.
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @returns {Number} Summed value
*
* @example
* // Simply get the sum of a column
* var table = $('#example').DataTable();
* table.column( 3 ).data().sum();
*
* @example
* // Insert the sum of a column into the columns footer, for the visible
* // data on each draw
* $('#example').DataTable( {
* drawCallback: function () {
* var api = this.api();
* $( api.table().footer() ).html(
* api.column( 4, {page:'current'} ).data().sum()
* );
* }
* } );
*/
DataTable.Api.register('sum()', function () {
return this.flatten().reduce(function (a, b) {
if (typeof a === 'string') {
a = a.replace(/[^\d.-]/g, '') * 1;
}
if (typeof b === 'string') {
b = b.replace(/[^\d.-]/g, '') * 1;
}
return a + b;
}, 0);
});
export default DataTable;

@ -1,10 +0,0 @@
{
"name": "datatables.net-plugins",
"license": "MIT",
"main": [],
"ignore": [],
"dependencies": {
"jquery": ">=1.7.0",
"datatables": "^2"
}
}

@ -1,8 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
declare module 'datatables.net' {
interface Api<T> {
/** Average the values in a data set. */
average(): Number;
}
}
export {};

@ -1,150 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window === 'undefined') {
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.document );
}
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* @summary Download Button
* @author SpryMedia Ltd (www.datatables.net)
* @copyright Copyright 2018 SpryMedia Ltd.
*
* License MIT - http://datatables.net/license/mit
*
* A button that can be used to trigger a server-side action, typically a
* download of a file generated by the server. If server-side processing
* is enabled in the host table it will automatically add the last parameters
* used for a table draw allowing the script to output a file with the same
* order / search applied as the main table.
*
* This is particularly useful when using server-side processing and wishing
* to allow user export of the data in a table. The default Buttons package
* will only export the data available on the client-side, while this button
* can be used to let the server generate the required file and then download
* it to the client-side.
*
* @example
* // Download button
* var table = $('#example').DataTable({
* dom: 'Bfrtip',
* buttons: [
* {
* extend: 'download',
* url: '/api/download'
* }
* ]
* });
*/
function flattenJson(data, name, flattened) {
if (!flattened) {
flattened = {};
}
if (!name) {
name = '';
}
if ($.isPlainObject(data) || Array.isArray(data)) {
$.each(data, function (idx, val) {
if (name === '') {
flattenJson(val, idx, flattened);
}
else {
flattenJson(val, name + '[' + idx.toString() + ']', flattened);
}
});
}
else {
flattened[name] = data;
}
return flattened;
}
DataTable.ext.buttons.download = {
text: 'Download',
action: function (e, dt, node, config) {
// Gather information to be submitted
var data = {};
if (dt.page.info().serverSide) {
$.extend(data, dt.ajax.params());
}
if (typeof config.data === 'function') {
config.data(data);
}
else if (typeof config.data === 'object') {
$.extend(data, config.data);
}
// Convert data to a flat structure for submission
var flattened = flattenJson(data);
// Create an iframe
var iframe = $('<iframe/>')
.css({
border: 'none',
height: 0,
width: 0,
})
.appendTo(document.body);
var contentDoc = iframe[0].contentWindow.document;
contentDoc.open();
contentDoc.close();
var form = $('<form/>', contentDoc)
.attr('method', config.type)
.attr('action', config.url)
.appendTo(contentDoc.body);
$.each(flattened, function (name, val) {
$('<input/>', contentDoc)
.attr('type', 'text')
.attr('name', name.toString())
.attr('autocomplete', 'no')
.val(val)
.appendTo(form);
});
form.submit();
},
url: '',
type: 'POST',
data: {},
};
return DataTable;
}));

@ -1,2 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(n){var o,a;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return n(t,window,document)}):"object"==typeof exports?(o=require("jquery"),a=function(t,e){e.fn.dataTable||require("datatables.net")(t,e)},"undefined"==typeof window?module.exports=function(t,e){return t=t||window,e=e||o(t),a(t,e),n(e,0,t.document)}:(a(window,o),module.exports=n(o,window,window.document))):n(jQuery,window,document)}(function(i,t,u,e){"use strict";var n=i.fn.dataTable;return n.ext.buttons.download={text:"Download",action:function(t,e,n,o){var a={},e=(e.page.info().serverSide&&i.extend(a,e.ajax.params()),"function"==typeof o.data?o.data(a):"object"==typeof o.data&&i.extend(a,o.data),function n(t,o,a){return a=a||{},o=o||"",i.isPlainObject(t)||Array.isArray(t)?i.each(t,function(t,e){n(e,""===o?t:o+"["+t.toString()+"]",a)}):a[o]=t,a}(a)),d=i("<iframe/>").css({border:"none",height:0,width:0}).appendTo(u.body)[0].contentWindow.document,r=(d.open(),d.close(),i("<form/>",d).attr("method",o.type).attr("action",o.url).appendTo(d.body));i.each(e,function(t,e){i("<input/>",d).attr("type","text").attr("name",t.toString()).attr("autocomplete","no").val(e).appendTo(r)}),r.submit()},url:"",type:"POST",data:{}},n});

@ -1,2 +0,0 @@
/*! © SpryMedia Ltd - datatables.net/license */
import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;function flattenJson(t,e,o){return o=o||{},e=e||"",$.isPlainObject(t)||Array.isArray(t)?$.each(t,function(t,a){flattenJson(a,""===e?t:e+"["+t.toString()+"]",o)}):o[e]=t,o}DataTable.ext.buttons.download={text:"Download",action:function(t,a,e,o){var n={},a=(a.page.info().serverSide&&$.extend(n,a.ajax.params()),"function"==typeof o.data?o.data(n):"object"==typeof o.data&&$.extend(n,o.data),flattenJson(n)),r=$("<iframe/>").css({border:"none",height:0,width:0}).appendTo(document.body)[0].contentWindow.document,d=(r.open(),r.close(),$("<form/>",r).attr("method",o.type).attr("action",o.url).appendTo(r.body));$.each(a,function(t,a){$("<input/>",r).attr("type","text").attr("name",t.toString()).attr("autocomplete","no").val(a).appendTo(d)}),d.submit()},url:"",type:"POST",data:{}};export default DataTable;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save