row data by index
row data by index
harald
Posts: 16Questions: 7Answers: 1
After clicking on the table, I am retrieving my row data with the respective index in the following way:
$('#testTable').on('click', 'tr td', function () {
var tableClass = $('#testTable').DataTable();
var idx = tableClass
.row( this )
.index();
// row data
var tr = $(this).closest('tr');
row = tableClass.row( tr );
});
Later, I need to get the row data simply via the index. How can I do this.
Thanks for any help!
Answers
var row = tableClass.row( 4 );
Yep, you could also use the
td
node forcell-selector
intocell()
- something like this :