API function to get row and column from a node when using the responsive plugin
API function to get row and column from a node when using the responsive plugin
Hi,
Is it possible to add a function that will give us the row and column from an HTML node in a normal table
and an equivalent function in responsive?
That function could hide the complexity of visible/hidden columns, if the node is a td element or a child of it and if the column is in the original row or collapsed in the details row.
Currently I need to do something like this:
$('#table tbody').on('click', 'tr', function(e) {
var t = $($table).dataTable().api(),
cellIndex = t.responsive.index(e.target.closest('li')),
row,
index;
if(typeof cellIndex.row !== 'undefined') {
row = t.row(cellIndex.row);
index = cellIndex.column;
} else {
row = t.row(this);
index = t.cell($(e.target).closest('td')).index().column;
}
}
Thanks
Answers
I've highlight the code to make it easier to read.