I am getting console error "Uncaught TypeError: Cannot set property 'nTf' of undefined". I am using jquery Datatable.
问题:
回答1:
Okey Let me just to be clear for everyone , tfoot > th
must be equal as your thead > th
i just faced this kind of problem recently and trying to figure it out like couple mins so just make sure in the future someone maybe be faced it
回答2:
As per https://datatables.net/forums/discussion/22697/uncaught-typeerror-cannot-set-property-ntf-of-undefined you probably have more cells in the header and/or footer of your table defined in your html than you are getting back from the server.
At least that's the issue I was having which gave me this error message.
回答3:
Hi I had same problem but now I have fixed my problem. This problem occurs because there are more column in head tag than body tag. If you have same error then first check how many column in thead and tbody or tfoot .
回答4:
In your table Check all colspan attribute values if its equal to the number of columns
回答5:
I ran into this problem too. All columns in tfoot matched thead. Just a simple step of clearing browser cache did the magic for me. Hope this helps someone.
回答6:
Also, this error occurred for me when the columns in my Datatables setup did not match the columns in my HTML.
I fixed it by making sure they match.
(In the image below, they do not match, which caused the error.)