API
DataTables has an extensive API which can be used to access the data contained in a table and otherwise manipulate the table after the table initialisation has completed. The DataTables API is designed to reflect the structure of the data in the table and how you will typically interact with the table through the API. It can also be extended by the extensions and plug-ins providing additional features and operations.
A DataTables API instance is returned when you create a new table, or a new API instance can be created for an existing table using DataTable.Api - e.g.:
// Create a new DataTable
let table = new DataTable('#myTable', {
// options
});
// Or, for an existing DataTable:
let table = new DataTable.Api('#myTable');
For general information on how the DataTables API operates, including its chaining, how to work with multiple tables and definitions of the terminology used in this reference, please prefer to the API manual.
| Name | Summary | Library | Group |
|---|---|---|---|
Perform a jQuery selection action on the full table. | DataTables | core | |
Make an Ajax call to a server | DataTables | static | |
Register a date / time format for DataTables to use | DataTables | static | |
Create a new feature that can be used for layout | DataTables | static | |
Save a file that has been created on the client-side | Buttons | ||
Check is a table node is a DataTable or not | DataTables | static | |
Set a license key | DataTables | static | |
Get all DataTables on the page | DataTables | static | |
Get / set details of a data type | DataTables | static | |
Get a list of the data types registered | DataTables | static | |
Get / set the libraries or global object upon which DataTables uses | DataTables | static | |
Wait for a timeout before calling a function | DataTables | static | |
Normalise diacritic characters in a string. | DataTables | static | |
Escape HTML entities to make a user input string safe | DataTables | static | |
Escape special characters in a regular expression string | DataTables | static | |
Create a read function from a descriptor | DataTables | static | |
Create a write function from a descriptor | DataTables | static | |
Remove HTML from a string | DataTables | static | |
Throttle the calls to a method to reduce call frequency | DataTables | static | |
Get all unique items from an array | DataTables | static | |
Version number compatibility check function | DataTables | static | |
Namespace for Ajax methods | DataTables | core | |
Get the latest JSON data obtained from the last Ajax request DataTables made | DataTables | core | |
Get the data submitted by DataTables to the server in the last Ajax request | DataTables | core | |
Reload the table data from the Ajax data source | DataTables | core | |
Get / set the URL that DataTables uses to Ajax fetch data | DataTables | core | |
Load data from the newly set data source URL | DataTables | core | |
Determine if there are any entries in the result set | DataTables | utility | |
Disable AutoFill's interactions | AutoFill | ||
Enable or disable AutoFill's interactions | AutoFill | ||
Determine if AutoFill is enabled or disabled | AutoFill | ||
Select a single button | Buttons | ||
Get / set the action function for the selected button | Buttons | ||
Get / set the active state of the selected button | Buttons | ||
Create a new button and add it to the document | Buttons | ||
Rebuild a buttons collection | Buttons | ||
Disable the selected button | Buttons | ||
Enable / disable the selected button | Buttons | ||
Get the index of a node | Buttons | ||
Get the button node for the selected button | Buttons | ||
Show popover box for a button, allowing extra user input | Buttons | ||
Get / set the processing state for a button | Buttons | ||
Remove and delete the selected button | Buttons | ||
Get / set the text for the selected button | Buttons | ||
Trigger the action of the selected button | Buttons | ||
Select one or more buttons | Buttons | ||
Get / set the action functions for the selected buttons | Buttons | ||
Set the active state for the selected buttons | Buttons | ||
Rebuild a buttons collection | Buttons | ||
Get the container element for a single Buttons instance | Buttons | ||
Get the container elements for one or more button instances | Buttons | ||
Destroy one or more button instances and remove from the document | Buttons | ||
Disable the selected buttons | Buttons | ||
Enable / disable the selected buttons | Buttons | ||
Get the button nodes for the selected buttons | Buttons | ||
Set the processing state for multiple buttons | Buttons | ||
Remove and delete the selected buttons | Buttons | ||
Get / set the text for the selected buttons | Buttons | ||
Trigger the action of the selected buttons | Buttons | ||
Obtain data from the DataTable that is suitable for exporting | Buttons | ||
Get export meta information that is common to many different button types | Buttons | ||
Display and hide information for the end user in a modal box | Buttons | ||
Get / set the table's caption | DataTables | tables | |
Get the table's | DataTables | tables | |
Determine if the cards or table is shown | CardView | ||
Get / set the mode CardView is operating in | CardView | ||
Select a single cell from a table. | DataTables | cells | |
Get / set data for the selected cell | DataTables | cells | |
Deselect a single cell | Select | ||
Edit a cell with inline or bubble editing | Editor | ||
Focus on a cell | KeyTable | ||
Get index information about the selected cell | DataTables | cells | |
Invalidate the data held in DataTables for the selected cells | DataTables | cells | |
Get the DOM element for the selected cell | DataTables | cells | |
Get rendered data for a cell | DataTables | cells | |
Select a single cell | Select | ||
Determine if a cell has been selected | Select | ||
Blur focus from the table | KeyTable | ||
Select multiple cells from a table. | DataTables | cells | |
Get data for the selected cells | DataTables | cells | |
Deselect cells | Select | ||
Edit cells with bubble editing | Editor | ||
Iterate over each selected cell, with the function context set to be the cell in question. | DataTables | cells | |
Get index information about the selected cells | DataTables | cells | |
Invalidate the data held in DataTables for the selected cells | DataTables | cells | |
Get the DOM elements for the selected cells | DataTables | cells | |
Get rendered data for a collection of cells | DataTables | cells | |
Select cells | Select | ||
Clear the table of all data. | DataTables | core | |
Disable ColReorder's interactions | ColReorder | ||
Enable or disable ColReorder's interactions | ColReorder | ||
Programmatically move columns | ColReorder | ||
Get / set column order | ColReorder | ||
Restore the loaded column order | ColReorder | ||
Convert one or more column indexes to and from current and original indexes | ColReorder | ||
Select a single column from a table. | DataTables | columns | |
Remove any ColumnControl applied search from the selected column | ColumnControl | ||
Load new options for the search list | ColumnControl | ||
Get the data for the cells in the selected column. | DataTables | columns | |
Get the data source property for the selected column. | DataTables | columns | |
Deselect a single column | Select | ||
Get the footer node for the selected column. | DataTables | columns | |
Get the header node for the selected column. | DataTables | columns | |
Get the column index of the selected column. | DataTables | columns | |
Get the initialisation options for a column. | DataTables | core | |
Get the name for the selected column. | DataTables | columns | |
Get the cell nodes for the selected column. | DataTables | columns | |
Order the table by the selected column. | DataTables | columns | |
Get information about the orderable status of a column. | DataTables | columns | |
Get rendered data for a column | DataTables | columns | |
Get the responsive visibility state of a column in the table | Responsive | ||
Search for data in the selected column. | DataTables | columns | |
Get / set a named search to apply to a column. | DataTables | core | |
Select a single column | Select | ||
Determine if a column has been selected | Select | ||
Get / set the title for a column. | DataTables | columns | |
Get a column's data type. | DataTables | columns | |
Get / set the visibility of a single selected column. | DataTables | columns | |
Get the width of a column. | DataTables | columns | |
Convert between column index formats | DataTables | columns | |
Select multiple columns from a table. | DataTables | columns | |
Remove any ColumnControl applied search from the selected columns | ColumnControl | ||
Load new options for the search list | ColumnControl | ||
Get the data for the cells in the selected columns. | DataTables | columns | |
Get the data source property for the selected columns. | DataTables | columns | |
Deselect columns | Select | ||
Iterate over each selected column, with the function context set to be the column in question. | DataTables | columns | |
Get the footer nodes for the selected columns. | DataTables | columns | |
Get the header node for the selected columns. | DataTables | columns | |
Get the column indexes of the selected columns. | DataTables | columns | |
Get the initialisation options for the selected columns. | DataTables | core | |
Get the names for the selected columns. | DataTables | columns | |
Get the cell nodes for the selected columns. | DataTables | columns | |
Order the table by the selected columns. | DataTables | columns | |
Get information about the orderable status of the selected columns. | DataTables | columns | |
Get rendered data for a collection of columns | DataTables | columns | |
Get the responsive visibility state of columns in the table | Responsive | ||
Search for data in the selected columns. | DataTables | columns | |
Get / set a named search to apply to a column. | DataTables | core | |
Select columns | Select | ||
Get / set the title for multiple columns. | DataTables | columns | |
Get the data types for selected columns. | DataTables | columns | |
Get / set the visibility of the selected columns. | DataTables | columns | |
Get the widths of a group of columns. | DataTables | columns | |
Recalculate the column widths | DataTables | columns | |
Get the number of elements that are contained in an API instance | DataTables | utility | |
Get the data for the whole table. | DataTables | core | |
Destroy the DataTables in the current context. | DataTables | core | |
Redraw the table. | DataTables | core | |
Iterate over the contents of the API result set. | DataTables | utility | |
Get the Editor instance associated with this table. | Editor | ||
Reduce an Api instance to a single context and result set. | DataTables | utility | |
Trigger an error message. | DataTables | utility | |
Get information about an uploaded file | Editor | editor | |
Get information about multiple uploaded files | Editor | editor | |
Create a new API instance with all elements from the result set which pass a given test. | DataTables | utility | |
Namespace for FixedColumns methods | FixedColumns | ||
Get / set the number of columns fixed at the end of a table | FixedColumns | ||
Get / set the number of fixed columns on the left side of a table | FixedColumns | ||
Get / set the number of fixed columns on the right side of a table | FixedColumns | ||
Get / set the number of columns fixed at the start of a table | FixedColumns | ||
Recalculate the position of the table and redraw the fixed elements | FixedHeader | ||
Disable the fixed elements | FixedHeader | ||
Enable / disable the fixed elements | FixedHeader | ||
Get the current enabled status | FixedHeader | ||
Get / set the fixed footer's offset | FixedHeader | ||
Get / set the fixed header's offset | FixedHeader | ||
Flatten a 2D array structured API instance to a 1D array structure. | DataTables | utility | |
Get the underlying data from a DataTable instance | DataTables | utility | |
Internationalisation token lookup. | DataTables | core | |
Determine if an API result set contains a given value. | DataTables | utility | |
Find the first instance of a value in the API instance's result set. | DataTables | utility | |
Get the initialisation options used for the table. | DataTables | core | |
Iterate over a result set of table, row, column or cell indexes | DataTables | utility | |
Join the elements in the result set into a string. | DataTables | utility | |
Disable KeyTable's interactions (mouse and keyboard) | KeyTable | ||
Enable or disable KeyTable's interactions (mouse and keyboard) | KeyTable | ||
Determine the KeyTable enabled state for a table | KeyTable | ||
Move the focus to an adjacent cell | KeyTable | ||
Find the last instance of a value in the API instance's result set. | DataTables | utility | |
Number of elements in an API instance's result set. | DataTables | utility | |
Create a new API instance with the result set defined by the values returned from the callback function. | DataTables | utility | |
Table events removal. | DataTables | core | |
Table events listener. | DataTables | core | |
Listen for a table event once and then remove the listener. | DataTables | core | |
Get / set the ordering applied to the table. | DataTables | core | |
Get / set the fixed ordering applied to the table. | DataTables | core | |
Add an ordering listener to an element, for a given column. | DataTables | core | |
Get / set the current page of the table. | DataTables | core | |
Get paging information about the table | DataTables | core | |
Get / set the table's page length. | DataTables | core | |
Create a new API instance with the value of a property from the objects in the current result set. | DataTables | utility | |
Remove the last item from an API instance's result set. | DataTables | utility | |
Set the processing indicator state for the DataTable. | DataTables | core | |
Add one or more items to the end of an API instance's result set. | DataTables | utility | |
Determine if a DataTable is ready. | DataTables | utility | |
Apply a callback function against and accumulator and each element in the Api's result set (left-to-right). | DataTables | utility | |
Apply a callback function against and accumulator and each element in the Api's result set (right-to-left). | DataTables | utility | |
Determine if Responsive has hidden any columns in the table | Responsive | ||
Obtain the cell index from a | Responsive | ||
Recalculate the column breakpoints based on the class information of the column header cells | Responsive | ||
Recalculate the widths used by responsive after a change in the display | Responsive | ||
Reverse the result set of the API instance. | DataTables | utility | |
Select a single row from a table. | DataTables | rows | |
Blur focus from a row | Select | ||
Row child method namespace | DataTables | rows | |
Get / set the child rows of the selected main table row | DataTables | rows | |
Hide child rows after creating new child rows | DataTables | rows | |
Destroy child row(s) for the selected parent row | DataTables | rows | |
Make newly defined child rows visible | DataTables | rows | |
Hide the child row(s) of a parent row | DataTables | rows | |
Check if the child rows of a parent row are visible | DataTables | rows | |
Destroy child row(s) for the selected parent row | DataTables | rows | |
Make the child row(s) of a parent row visible | DataTables | rows | |
Get / set the data for the selected row. | DataTables | rows | |
Delete an existing row | Editor | ||
Deselect a single row | Select | ||
Edit an existing row | Editor | ||
Move keyboard focus to a specific row | Select | ||
Get the id of the selected row. | DataTables | rows | |
Get the row index of the selected row. | DataTables | rows | |
Invalidate the data held in DataTables for the selected row | DataTables | rows | |
Get the row | DataTables | rows | |
Delete the selected row from the DataTable. | DataTables | rows | |
Scroll to a specific row | Scroller | ||
Select a single row | Select | ||
Determine if a row has been selected | Select | ||
Add a new row to the table. | DataTables | rows | |
Create a new row | Editor | ||
Get / set the data source for the row grouping | RowGroup | ||
Disable RowGroup's interaction with the table | RowGroup | ||
Enable or disable RowGroup's interaction with the table | RowGroup | ||
Determine if RowGroup is enabled on a table | RowGroup | ||
Disable the user's ability to reorder rows. | RowReorder | ||
Enable / disable the user's ability to reorder rows. | RowReorder | ||
Select multiple rows from a table. | DataTables | rows | |
Get the data for the selected rows. | DataTables | rows | |
Delete multiple existing rows | Editor | ||
Deselect rows | Select | ||
Edit multiple existing rows | Editor | ||
Iterate over each selected row, with the function context set to be the row in question. | DataTables | rows | |
Get the ids of the selected rows. | DataTables | rows | |
Get the row indexes of the selected rows. | DataTables | rows | |
Invalidate the data held in DataTables for the selected rows | DataTables | rows | |
Get the row | DataTables | rows | |
Delete the selected rows from the DataTable. | DataTables | rows | |
Select rows | Select | ||
Add multiple new rows to the table. | DataTables | rows | |
Recalculate the cached measurements that Scroller uses | Scroller | ||
Get information about the rows that are currently being displayed | Scroller | ||
Scroll to a specific row display index | Scroller | ||
Search for data in the table. | DataTables | core | |
Get / set a named search to apply to a table. | DataTables | core | |
Returns the node of the SearchBuilder container. | SearchBuilder | ||
Get the details of the current search setup | SearchBuilder | ||
Rebuild the search to a given state | SearchBuilder | ||
Initialise Select from outside of the constructor | Select | ||
Get / set the blurable state of the table's item selection options | Select | ||
Get / set the information summary display state | Select | ||
Get / set the items that Select will select based on user interaction (rows, columns or cells) | Select | ||
Get / set Select's keyboard navigation state | Select | ||
Get / set the function used to determine if a row should be selectable | Select | ||
Get / set the item selector for mouse event capture | Select | ||
Get / set the style by which the end user can select items in the table | Select | ||
Get / set the behaviour if items can be deselected when a selected item is clicked on | Select | ||
Obtain the table's settings object | DataTables | core | |
Remove the first item from an API instance's result set. | DataTables | utility | |
Create an independent copy of the API instance. | DataTables | utility | |
Sort the elements of the API instance's result set. | DataTables | utility | |
Modify the contents of an Api instance's result set, adding or removing items from it as required. | DataTables | utility | |
Get / set the state of the table | DataTables | core | |
Clear the saved state of the table. | DataTables | core | |
Get the table state that was loaded during initialisation. | DataTables | core | |
Trigger a state save. | DataTables | core | |
Get the details of all of the currently active states | StateRestore | ||
Get a state from StateRestore | StateRestore | ||
Load a state from StateRestore into the table | StateRestore | ||
Remove a state from StateRestore | StateRestore | ||
Rename a state from StateRestore | StateRestore | ||
Save a state from StateRestore | StateRestore | ||
Create a new state | StateRestore | ||
Get states from StateRestore | StateRestore | ||
Remove states from StateRestore | StateRestore | ||
Select a table based on a selector from the API's context | DataTables | tables | |
Get the | DataTables | tables | |
Get the | DataTables | tables | |
Get the | DataTables | tables | |
Get a JavaScript representation of the table footer structure | DataTables | tables | |
Get the | DataTables | tables | |
Get a JavaScript representation of the table header structure | DataTables | tables | |
Get the | DataTables | tables | |
Select tables based on a selector from the API's context | DataTables | tables | |
Get the | DataTables | tables | |
Get the | DataTables | tables | |
Get the | DataTables | tables | |
Get the | DataTables | tables | |
Get the | DataTables | tables | |
Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set. | DataTables | utility | |
Create a native JavaScript array object from an API instance. | DataTables | utility | |
Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set. | DataTables | utility | |
Trigger an event. | DataTables | core | |
Create a new API instance containing only the unique items from the elements in an instance's result set. | DataTables | utility | |
Add one or more items to the start of an API instance's result set. | DataTables | utility |