How to use row-selector with ID to get one row from jQuery Datatables?
How to use row-selector with ID to get one row from jQuery Datatables?
I am trying to select one specific row from a jQuery Datatables using the row-selector with the ID in string format.
The Id's for each row are assigned using DT_RowId from a JSON server by the server.
<tr id="row-404" role="row" class="odd">
<td class="text-nowrap">404</td>
<td>Some random columns</td>
</tr>
I cannot get the row to be selected using the following script:
var table = $("#datatable");
if ($.fn.DataTable.fnIsDataTable(table)) {
table = table.DataTable();
var rowSelector = "row-404";
var row = table.row(rowSelector);
var data = row.data();
console.log(data);
}
I manged to get the some rows using other selectors (example: the jQuery selector), but since I am using pagination, they do not work if your row is on another page.
Answers
Hi Florinsecal
should be
If you want more information on using row-selector then please refer to the documentation for
row-selector
,