Since: DataTables 2.0

Determine if an API result set contains a given value.


You may find it useful to know if an API instance's result set contains a particular value. While that can be achieved readily with indexOf(), this utility method can be a useful short-cut if you don't need to know the value's location in the result set.

This method makes use of the fact that DataTables API objects are "array like", in that they inherit a lot of the abilities and methods of the Javascript Array type.


function includes( value )


Determine if a result set contains the value given.


true if found, false if not.


Check if a value is visible on the current page:

var table = new DataTable('#myTable');

var found = table
	.column(0, { page: 'current' })

if (found) {
	alert('21 was not found in the result set');
else {
	alert('21 was found at index: ' + index);


The following options are directly related and may also be useful in your application development.