krishna89
krishna89

Reputation: 846

jQuery datatables - Uncaught TypeError: a.charAt is not a function

I am trying to integrate datatables jQuery plugin into my table generated through PHP.

The table layout and everything looks fine with search and sorting options but when clicking on any sorting options in table headers I am facing this error

Uncaught TypeError: a.charAt is not a function

Did anyone face this problem before? Any help would be appreciated.

Upvotes: 2

Views: 5419

Answers (3)

Jussi Palo
Jussi Palo

Reputation: 955

This issue existed (at least) on Datatables 1.10.5, but no longer on 1.10.16, so it has been since fixed.

Upvotes: 4

Yul S
Yul S

Reputation: 147

Datatable bug connected with changes in empty string processing by map function. Fixed in some code I saw.

Quick fix in my case was to replace match(/"[^"]+"|[^ ]+/g)||'' with match(/"[^"]+"|[^ ]+/g)||[''] (empty value as array) in datatable code.

Upvotes: 7

Arun
Arun

Reputation: 59

It's because either you have multiple jQuery loaded in the same page or you are loading datatable before loading jQuery.

To resolve the issue:

  • Make sure only 1 jQuery is loaded
  • Load jQuery first then the datatable (Order matters)

Upvotes: 0

Related Questions