Select a single row from a table.
Working with rows is a fundamental part of DataTables, and you want to be able to easily select the rows that you want from the table. This method is the row counterpart to the
cells() methods for working with columns and cells in the table, respectively. Using a selector and the
selector-modifier option the rows at the table can be obtained with this method's own chained methods providing the ability to get the data from the rows, the row nodes and to invalidate the data, among other actions.
Note that if the selector used matches multiple rows, this method will truncate the result to contain just one row, the first matched one. If you require to work with multiple rows at the same time for group manipulation, please use this method's plural counterpart
rows() which can select and manipulate multiple rows.
function row( rowSelector [, modifier ] )
Select a row found by a row selector
Name Type Optional 1
Yes - default:
Option used to specify how the rows should be ordered, and if paging or search options in the table should be taken into account.
DataTables API instance with selected row in the result set
Select row with a given id:
let row = table.row('#myId');
Select row of given index:
let rows = table.rows(1);
Select row with matched data using a function:
let row = table.row((idx, data) => data.location === "Edinburgh");
The following options are directly related and may also be useful in your application development.