TypeError: j[k] is undefined
TypeError: j[k] is undefined
sutt
Posts: 10Questions: 1Answers: 0
So, the following code was working just fine, until I added the columns attribute:
table = $("table#datatable").DataTable(
{
columns: [
null,
null,
{ visible: false, targets: 2 }
],
paging: false,
destroy: true,
order: [],
dom: '<"select_all_wrapper"><"clearfilter">frtip'
});
I had added a third column, but I need to keep it hidden (but available for filtering).
Now, when this function is called with new data (a new table arriving from the server), i get this message in the Firebug console:
TypeError: j[k] is undefined
However, when I call the function again with a new table of data, the datatable is created successfully.
Does anyone have any idea what could be happening?
This discussion has been closed.
Replies
in that snippet, you can leave out the "targets:2". That wasn't there when I first started getting the error, and I'm not sure it's relevant.
So, essentially, it works, then it doesn't work, then it works, then it doesn't work, etc...
It alternates between creating the datatable successfully and failing to create the datatable with each successive call.
Here's a test case, using the lib I'm using, 1.10.4.
http://live.datatables.net/norogavi/1/edit?html,css,js,output
In this, you get a TypeError j[k] is undefined when the datatable is re-initialized (even though the HTML in second_table is the same as the original.
In 1.10.7, the error is TypeError i[n] is undefined
Solved. Simple fix, forgot to add the new header for the third column...