Details parent() to get the row?
Details parent() to get the row?
I'm using Row details to display extra information for each item in my table.
I see from the source row I can use row.child() to get a reference to the details panel (if it exists) for a given row.
Is there a way to go backwards? If I have a reference for the details can I get the parent?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @Rothrock42 ,
I don't believe you can, not if it's just the return from
row.child(). If it's the jQuery node, you could usenearest('tr'), but I suspect that's no use for you,Cheers,
Colin
Yes, there isn't an API to go backwards as such, but you could use
$().nearest()as Colin suggests and then$().prev()to select the previoustrwhich would be the parent row.Alternatively, use
row().child()looping over each row in the table and checking to see if it has the child row you are looking for. I think that's the approach I'd take.Allan
Thanks for the suggestions. I think the combination of nearest() and prev() will do it.