4 * Provide a common method for plug-ins to check the version of DataTables being used, in order
5 * to ensure compatibility.
6 * @param {string} sVersion Version string to check for, in the format "X.Y.Z". Note that the
7 * formats "X" and "X.Y" are also acceptable.
8 * @returns {boolean} true if this version of DataTables is greater or equal to the required
9 * version, or false if this version of DataTales is not suitable
14 * alert( $.fn.dataTable.fnVersionCheck( '1.9.0' ) );
16 DataTable.fnVersionCheck = function( sVersion )
18 /* This is cheap, but effective */
19 var fnZPad = function (Zpad, count)
21 while(Zpad.length < count) {
26 var aThis = DataTable.ext.sVersion.split('.');
27 var aThat = sVersion.split('.');
28 var sThis = '', sThat = '';
30 for ( var i=0, iLen=aThat.length ; i<iLen ; i++ )
32 sThis += fnZPad( aThis[i], 3 );
33 sThat += fnZPad( aThat[i], 3 );
36 return parseInt(sThis, 10) >= parseInt(sThat, 10);
41 * Check if a TABLE node is a DataTable table already or not.
42 * @param {node} nTable The TABLE node to check if it is a DataTable or not (note that other
43 * node types can be passed in, but will always return false).
44 * @returns {boolean} true the table given is a DataTable, or false otherwise
49 * var ex = document.getElementById('example');
50 * if ( ! $.fn.DataTable.fnIsDataTable( ex ) ) {
54 DataTable.fnIsDataTable = function ( nTable )
56 var o = DataTable.settings;
58 for ( var i=0 ; i<o.length ; i++ )
60 if ( o[i].nTable === nTable || o[i].nScrollHead === nTable || o[i].nScrollFoot === nTable )
71 * Get all DataTable tables that have been initialised - optionally you can select to
72 * get only currently visible tables.
73 * @param {boolean} [bVisible=false] Flag to indicate if you want all (default) or
74 * visible tables only.
75 * @returns {array} Array of TABLE nodes (not DataTable instances) which are DataTables
80 * var table = $.fn.dataTable.fnTables(true);
81 * if ( table.length > 0 ) {
82 * $(table).dataTable().fnAdjustColumnSizing();
85 DataTable.fnTables = function ( bVisible )
89 jQuery.each( DataTable.settings, function (i, o) {
90 if ( !bVisible || (bVisible === true && $(o.nTable).is(':visible')) )