Error when attempting to destroy after child row is created
Error when attempting to destroy after child row is created
We're using DT v1.10.2 to present search results. Some of those are movie links, which invoke a movie player in child rows. Once a movie has been played, the following error results when a new search is run, preventing the search results from being repopulated in the table.
Uncaught TypeError: Cannot read property 'length' of undefined
The error occurs after the 3rd line in this function:
var bb = function (a) {
var b = a.context;
b.length && a.length && (a = b[0].aoData[a[0]], a._details && (a._details.remove(), a._detailsShow = l, a._details = l))
}, Tb = function (a, b) {
var c = a.context;
if (c.length && a.length) {
...
}
};
At this point a
is an object and b
is undefined.
Here's the relevant portion of the init function:
seriesTable = jQuery(table).DataTable({
"bFilter": false,
"bLengthChange": true,
"aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
"bAutoWidth": false,
"sPaginationType": "full_numbers",
"bDestroy": true,
"bJQueryUI": true,
...
And we're creating the child rows like this:
newChildRow.child(newChildRowData).show();
clickedRow.addClass('shown');
Thank you.
Replies
Here's the relevant bit from the unminified file (starting at line 7803). At the if statement
api
is an object andctx
is undefined.I found workaround to this issue. I cleared all the rows before destroying data table. Here is my solution.
seriesTable.clear().destroy();
Hi,
Thanks for flagging this up. I've just committed a fix and the nightly is currently rebuilding with the fix. It will be part of 1.10.3 which should be published by the end of the month.
Thanks,
Allan
Fantastic! Thanks to both of you. I was at my wit's end with this project.
I'm seeing another error that may be related... after table.clear().destroy() and re-init, I cannot invoke a new child row due to the following error:
"Uncaught TypeError: Cannot read property '_detailsShow' of undefined"
It occurs in this function at line 7969:
Can you link to a page demonstrating the problem so I can debug and fix it if there is a problem in the DataTables core please.
Allan
Thanks, Allan. I'll contact you privately when I have something I can share.