mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-19 12:52:11 +01:00
API: Static methods updated for DataTables 1.10 camelCase
- Alias the static methods to camelCase and hungarian varients: - versionCheck() - tables() - isDataTable() - Small updates in styling of the static functions
This commit is contained in:
parent
78e4d32e30
commit
c750514e98
@ -1 +1 @@
|
|||||||
3d7f4f017ebe45834c414111774745d57168d4b9
|
9f491c3ae078c42f582c3a7594ee9ca77bf27f28
|
||||||
|
70
media/js/jquery.dataTables.js
vendored
70
media/js/jquery.dataTables.js
vendored
@ -8120,23 +8120,27 @@
|
|||||||
|
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide a common method for plug-ins to check the version of DataTables being used, in order
|
* Provide a common method for plug-ins to check the version of DataTables being
|
||||||
* to ensure compatibility.
|
* used, in order to ensure compatibility.
|
||||||
* @param {string} sVersion Version string to check for, in the format "X.Y.Z". Note that the
|
*
|
||||||
* formats "X" and "X.Y" are also acceptable.
|
* @param {string} version Version string to check for, in the format "X.Y.Z".
|
||||||
* @returns {boolean} true if this version of DataTables is greater or equal to the required
|
* Note that the formats "X" and "X.Y" are also acceptable.
|
||||||
* version, or false if this version of DataTales is not suitable
|
* @returns {boolean} true if this version of DataTables is greater or equal to
|
||||||
|
* the required version, or false if this version of DataTales is not
|
||||||
|
* suitable
|
||||||
* @static
|
* @static
|
||||||
* @dtopt API-Static
|
* @dtopt API-Static
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* alert( $.fn.dataTable.fnVersionCheck( '1.9.0' ) );
|
* alert( $.fn.dataTable.versionCheck( '1.9.0' ) );
|
||||||
*/
|
*/
|
||||||
DataTable.fnVersionCheck = function( sVersion )
|
DataTable.versionCheck = DataTable.fnVersionCheck = function( version )
|
||||||
{
|
{
|
||||||
var aThis = DataTable.ext.sVersion.split('.');
|
var aThis = DataTable.version.split('.');
|
||||||
var aThat = sVersion.split('.');
|
var aThat = version.split('.');
|
||||||
var iThis, iThat;
|
var iThis, iThat;
|
||||||
|
|
||||||
for ( var i=0, iLen=aThat.length ; i<iLen ; i++ ) {
|
for ( var i=0, iLen=aThat.length ; i<iLen ; i++ ) {
|
||||||
@ -8144,40 +8148,40 @@
|
|||||||
iThat = parseInt( aThat[i], 10 ) || 0;
|
iThat = parseInt( aThat[i], 10 ) || 0;
|
||||||
|
|
||||||
// Parts are the same, keep comparing
|
// Parts are the same, keep comparing
|
||||||
if (iThis === iThat)
|
if (iThis === iThat) {
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parts are different, return immediately
|
// Parts are different, return immediately
|
||||||
return iThis > iThat;
|
return iThis > iThat;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a TABLE node is a DataTable table already or not.
|
* Check if a `<table>` node is a DataTable table already or not.
|
||||||
* @param {node} nTable The TABLE node to check if it is a DataTable or not (note that other
|
*
|
||||||
* node types can be passed in, but will always return false).
|
* @param {node} table The `table` node to check if it is a DataTable or not
|
||||||
|
* (note that other node types can be passed in, but will always return
|
||||||
|
* false).
|
||||||
* @returns {boolean} true the table given is a DataTable, or false otherwise
|
* @returns {boolean} true the table given is a DataTable, or false otherwise
|
||||||
* @static
|
* @static
|
||||||
* @dtopt API-Static
|
* @dtopt API-Static
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* var ex = document.getElementById('example');
|
* var ex = document.getElementById('example');
|
||||||
* if ( ! $.fn.DataTable.fnIsDataTable( ex ) ) {
|
* if ( ! $.fn.DataTable.isDataTable( ex ) ) {
|
||||||
* $(ex).dataTable();
|
* $(ex).dataTable();
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
DataTable.fnIsDataTable = function ( nTable )
|
DataTable.isDataTable = DataTable.fnIsDataTable = function ( table )
|
||||||
{
|
{
|
||||||
var o = DataTable.settings;
|
var o = DataTable.settings;
|
||||||
|
|
||||||
for ( var i=0 ; i<o.length ; i++ )
|
for ( var i=0 ; i<o.length ; i++ ) {
|
||||||
{
|
if ( o[i].nTable === table || o[i].nScrollHead === table || o[i].nScrollFoot === table ) {
|
||||||
if ( o[i].nTable === nTable || o[i].nScrollHead === nTable || o[i].nScrollFoot === nTable )
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8187,27 +8191,27 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all DataTable tables that have been initialised - optionally you can select to
|
* Get all DataTable tables that have been initialised - optionally you can
|
||||||
* get only currently visible tables.
|
* select to get only currently visible tables.
|
||||||
* @param {boolean} [bVisible=false] Flag to indicate if you want all (default) or
|
*
|
||||||
* visible tables only.
|
* @param {boolean} [visible=false] Flag to indicate if you want all (default)
|
||||||
* @returns {array} Array of TABLE nodes (not DataTable instances) which are DataTables
|
* or visible tables only.
|
||||||
|
* @returns {array} Array of `table` nodes (not DataTable instances) which are
|
||||||
|
* DataTables
|
||||||
* @static
|
* @static
|
||||||
* @dtopt API-Static
|
* @dtopt API-Static
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* var table = $.fn.dataTable.fnTables(true);
|
* $.each( $.fn.dataTable.fnTables(true), function () {
|
||||||
* if ( table.length > 0 ) {
|
* $(table).DataTable().columns.adjust();
|
||||||
* $(table).dataTable().fnAdjustColumnSizing();
|
* } );
|
||||||
* }
|
|
||||||
*/
|
*/
|
||||||
DataTable.fnTables = function ( bVisible )
|
DataTable.tables = DataTable.fnTables = function ( visible )
|
||||||
{
|
{
|
||||||
var out = [];
|
var out = [];
|
||||||
|
|
||||||
jQuery.each( DataTable.settings, function (i, o) {
|
jQuery.each( DataTable.settings, function (i, o) {
|
||||||
if ( !bVisible || (bVisible === true && $(o.nTable).is(':visible')) )
|
if ( !visible || (visible === true && $(o.nTable).is(':visible')) ) {
|
||||||
{
|
|
||||||
out.push( o.nTable );
|
out.push( o.nTable );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user