DataTable.versionCheck()
Version number compatibility check function.
Description
This method provides the ability for plug-in developers to check a required version number against the running version of DataTables. For example, a plug-in such as Buttons might require DataTables 1.10.7 or newer. This method provides the ability to check that.
It can also be useful for plug-ins to ensure that any other version dependencies are met.
Please note that this is a static function and is accessed through the DataTable
or $.fn.dataTable
object, not an API instance. It can be accessed at any time, even before any DataTables have been created on the page.
Prior to DataTables 1.11 this method could be accessed through the $.fn.dataTable
object only. As of 1.11, either DataTable
or $.fn.dataTable
can be used.
Type
function versionCheck( version [, version2 ] )
- Description:
Check the compatibility of the running version of DataTables against a version string
- Returns:
true
if the second version (version2
) is greater or equal to the required version, orfalse
if the is not suitable
Examples
Non-jQuery: Check the compatibility of DataTables:
if (!DataTable.versionCheck('1.11')) {
alert('DataTables 1.11 or newer is required');
}
jQuery: Check the compatibility of DataTables:
if (!$.fn.dataTable.versionCheck('1.10.7')) {
alert('A newer version of DataTables is required');
}
Check that Buttons 1.5 or newer is used:
if (!$.fn.dataTable.versionCheck('1.5.0', $.fn.dataTable.Buttons.version)) {
alert('A newer version of BUttons is required');
}