Child Row - How to select Parent Row
Child Row - How to select Parent Row

I am using a nested child row for detailed information. I have a need to refresh the data for the parent row, and cannot figure out how to properly select the parent my javascript.
This is the javaScript that runs when a span is clicked within the child row:
// Add event listener for refreshing transaction queue
$('#table tbody').on('click', 'span.trans-in-queue-lineitem', function () {
var tr = $(this).closest('tr');
var tr2 = tr.prev('tr');
var row = table.row(tr2);
});
My selector for tr2 is what is giving me trouble.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Without a testcase with your specific child row implementation this is just going to be a guess.
Going from the example this will work:
That is what I needed. Thank you!
If using with collapse however, you’ll need to expand that a bit I think...
That
.
role='row'
was an accessibility workaround for a bug in Safari and Chrome years ago. Its proven to be very useful though - its stayingAllan
The suggestions above did not work for me. (I believe because .closest() goes up the DOM tree and the tr with the span that is clicked is in a sibling tr to the parent row.)
This is what did work: