Perform a jQuery selection action on the full table.
DataTables makes heavy use of DOM manipulation, removing rows from the document for paging and searching, and removing columns from the document for column visibility, among other actions. jQuery will not find these removed DOM elements when using a standard jQuery statement since it uses the document as the root element and some nodes under DataTables' control have been removed from the document.
To provide an easy method to continue using jQuery on these elements, so you can select elements regardless of searching, paging or any other feature of DataTables this method is provided.
The selector given to the
$() method will be run on all of the
tr elements in the table, and their descendent elements, with the found elements being returned as a jQuery object.
function $( selector [, modifier ] )
Perform a jQuery selector on the rows and contents of the rows in the tables'
Name Type Optional 1
jQuery selector to perform on the nodes inside the table's tbody tag.
Yes - default:
Option used to specify how the content's of the selected columns should be ordered, and if paging or filtering in the table should be taken into account. This is only useful for operations which involve rows, such as
jQuery object with the matched elements in its result set.
Find all cells with content's 'High' and add a class:
var table = $('#example').DataTable(); table .$(':contains("High")') .addClass('important');