I have an application that requires the detail rows to be another DataTable with support for column sorting and filtering. Initially this was implemented with the 1.9.4 of datatables but I could not get the sorting of the subtable to work. I've tried upgrading to 1.10.4 but the sorting still doesn't work.
Config for the subtable is:
{
"data": "movieSeries",
"order": [[0, "asc"]],
"columns": [
{"title": "Title", "data": "title"},
{"title": "Date Published", "data": "date"},
{"title": "# of Pages", "data": "pages"},
{"title": "Movie Release Year", "data": "movieReleaseYr"}
]
}
Data is:
{
"series": "Harry Potter",
"books": [
{
"title": "Harry Potter and the Philosopher's Stone",
"date": "6/1997",
"pages": "309",
"movieReleaseYr": "2001"
},
{
"title": "Harry Potter and the Chamber of Secrets",
"date": "7/1998",
"pages": "341",
"movieReleaseYr":"2002"
}
}
Subtable is rendered by when a click handler for tr fires. Click handler calls oTable.fnOpen(row, html, htmlClass). HTML for the subtable is below.
Title | Date Published | # of Pages | Movie Release Year |
---|---|---|---|
Harry Potter and the Chamber of Secrets | 7/1998 | 341 | 2002 |
Harry Potter and the Deathly Hollows | 7/2007 | 652 | 2010, 2011 |
Harry Potter and the Goblet of Fire | 8/2000 | 734 | 2005 |
Harry Potter and the Half-Blood Prince | 7/2005 | 652 | 2009 |
Harry Potter and the Order of the Phoenix | 6/2003 | 870 | 2007 |
Harry Potter and the Philosopher's Stone | 6/1997 | 309 | 2001 |
Harry Potter and the Prisoner of Azkaban | 8/1999 | 435 | 2004 |
But when I look at the event listeners in the chrome web console, the <th> rows do not have a click handler for th.sorting.