Opening child row for all selected rows.
Opening child row for all selected rows.
tangerine
Posts: 3,365Questions: 39Answers: 395
I need a button which will open child rows for all selected rows.
Assuming this is a valid way to obtain the selected rows:
var selectedRows = oTable.rows({ selected: true }).row();
how can I apply row.child.show() to each item in selectedRows?
Or am I missing a better way?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I would use the code below:
See this post on StackOverflow for demonstration and details.
See more articles about jQuery DataTables on gyrocode.com.
My apologies, @gyrocode - I should have provided more detail.
I am opening individual child rows like this:
getChildRow() is the equivalent to format() in your example, and it requires the specific data id to be provided.
How can I adapt your example to get the specific data id for passing to getChildRow()?
Many thanks for your help.
Does this work?
Kevin
Thanks, Kevin - but no.
I don't have the format() function. My getChildRow() makes an ajax call to retrieve the child row data, based on the id argument supplied, and returns the data formatted appropriately..
Sorry meant to remove the format() function (copy / paste error). I think the key is to use
this.data).Songs.song_id
as the parameter for the getChildRow() function.Kevin
I fixed this eventually, after taking a few steps back and looking at a bigger picture.
Thank you @Kevin and @gyrocode.
@tangerine, posted an article jQuery DataTables: How to expand/collapse all child rows with examples and more details.
See more articles about jQuery DataTables on gyrocode.com.
Nice work, @gyrocode, thanks for letting me know.