Uncaught TypeError: Cannot read property 'className' of undefined-Collection of common programming errors

I got an identical error to the one you’re getting now. I once encountered a very similar error using the Chosen library. The problem was (in Chosen’s case) that IDs with the [] characters were being used, thus confusing Javascript between css selectors and ids (remember that in CSS we can use [] to specify attributes).

In the case of DataTables, however, I noticed that the DataTables script itself was prepending class = " " before the first element in every tr element within the tbody.

The reason for this was because the HTML output from the php had a logical error. The faulting code:


        

There was an error at the bottom of the long, long table, indicating that postgres could not jump to row 208. This told me I needed to stop looping at i - 1, or $currentRow - 1.

Hence the fixed, working code:


        

Performing this change allowed DataTables to perform properly.

So although I cannot provide a working solution, I do advise you to look at your html mark-up, as that may be the source of your problem (ex, does your table have a tbody?).