mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-18 11:52:11 +01:00
Update: isDataTable()
static method will now accept jQuery objects and
selectors as a parameter to check if it is a dataTable. `tables()` static method rewritten for size
This commit is contained in:
parent
1ab67a880f
commit
4a65fb054a
@ -1 +1 @@
|
|||||||
2baec538cb6391e8e14a53c0d194b4b396e5600e
|
430d445673a4d7344a1888b453d9dd1a46f9129c
|
||||||
|
34
media/js/jquery.dataTables.js
vendored
34
media/js/jquery.dataTables.js
vendored
@ -8377,30 +8377,30 @@
|
|||||||
/**
|
/**
|
||||||
* 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} table The `table` node to check if it is a DataTable or not
|
* @param {node|jquery|string} table Table node, jQuery object or jQuery
|
||||||
* (note that other node types can be passed in, but will always return
|
* selector for the table to test. Note that if more than more than one
|
||||||
* false).
|
* table is passed on, only the first will be checked
|
||||||
* @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');
|
* if ( ! $.fn.DataTable.isDataTable( '#example' ) ) {
|
||||||
* if ( ! $.fn.DataTable.isDataTable( ex ) ) {
|
* $('#example').dataTable();
|
||||||
* $(ex).dataTable();
|
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
DataTable.isDataTable = DataTable.fnIsDataTable = function ( table )
|
DataTable.isDataTable = DataTable.fnIsDataTable = function ( table )
|
||||||
{
|
{
|
||||||
var o = DataTable.settings;
|
var t = $(table).get(0);
|
||||||
|
var is = false;
|
||||||
|
|
||||||
for ( var i=0 ; i<o.length ; i++ ) {
|
$.each( DataTable.settings, function (i, o) {
|
||||||
if ( o[i].nTable === table || o[i].nScrollHead === table || o[i].nScrollFoot === table ) {
|
if ( o.nTable === t || o.nScrollHead === t || o.nScrollFoot === t ) {
|
||||||
return true;
|
is = true;
|
||||||
}
|
}
|
||||||
}
|
} );
|
||||||
|
|
||||||
return false;
|
return is;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -8422,15 +8422,11 @@
|
|||||||
*/
|
*/
|
||||||
DataTable.tables = DataTable.fnTables = function ( visible )
|
DataTable.tables = DataTable.fnTables = function ( visible )
|
||||||
{
|
{
|
||||||
var out = [];
|
return jQuery.map( DataTable.settings, function (o) {
|
||||||
|
if ( !visible || (visible && $(o.nTable).is(':visible')) ) {
|
||||||
jQuery.each( DataTable.settings, function (i, o) {
|
return o.nTable;
|
||||||
if ( !visible || (visible === true && $(o.nTable).is(':visible')) ) {
|
|
||||||
out.push( o.nTable );
|
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
return out;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user