When a row is created, I would like to add a child row containing a <table>
, for later population via on.click()
+ DataTable()
+ ajax
. Pretty simple. The createdRow()
callback seems like a great place to do this ... if I could get it to work.
createdRow()
takes 4 parameters which appear to be the following.
row
- HTML element of the created rowdata
- plain ol' JSON of the new row's datadataIndex
- the row # within its tablecells
- DOM elements for the<td>
s that make up the row
None of these are DataTables or child objects. Not only that, I do not seem to have a way to get at the underlying <table>
element. Neither $(row).closest('table')
nor $(cells[0]).closest('table')
seem to return anything, and $(row).parent()
doesn't work either. It seems as though the row isn't inserted into the table yet.
If the row really hasn't been inserted into the table when createdRow()
is called, then I guess I just need to use another callback, like initComplete()
, and iterate over rows. But createdRow()
would be perfect, since all the data is right there in the args, so I hope I am just missing something simple and createdRow()
can be made to work.
Thanks!