14

When using the jQuery datatables plugin, why am I getting this error?

"k is undefined" -style typeof e.saved_aaSorting=="undefined")

2 Answers 2

31

I posted this answer to document something for future reference for myself, I hope it will help someone else on down the line.

From the usage page (a little RTFM):

In order for DataTables to be able to function correctly, the HTML for the target table must be laid out in a well formed manner with the 'thead' and 'tbody' sections declared.

In my case, the <thead> and <tbody> sections were missing. Oops.

Sign up to request clarification or add additional context in comments.

1 Comment

Also, '<thead></thead>' has to contain some '<th></th>'
2

In my case, one of the tables is without <thead> and <tbody>. It might be the cause of "K is undefined" error. Applying DataTables to the id (and not the element) could solve the problem.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.