dom()

Since: DataTables 3

Perform a query selection action on the full table.

Description

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. As such, simply using document.querySelector to pick elements will not find these removed DOM elements.

To provide an easy method to perform selectors 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 dom() 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 DataTable.Dom object.

Type

$( selector [, modifier ] )

Perform a CSS query selection on the rows and contents of the rows in the tables' tbody elements.

Parameters:

Returns:

DataTable.Dom: Dom object with the matched elements in its result set.

Example

Find all cells with a specific class and add another class:

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

table.dom('.myClass').classAdd('important');