Uncaught TypeError: Cannot read property 'asSorting' of undefined

Uncaught TypeError: Cannot read property 'asSorting' of undefined

stantor195stantor195 Posts: 4Questions: 0Answers: 0
edited April 2012 in General
Hi, I keep getting this error and I'm not sure how to fix it. Here is the code in my html file:
<script type="text/javascript"> $(document).ready( function () { $('#table_id').dataTable( { "aaSorting"= [] "aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]], iDisplayLength: 25, iDisplayStart: 3, "oLanguage": { "sZeroRecords": "There are no records that match your search criterion", "sLengthMenu": "Display _MENU_ records per page", "sInfo": "Displaying _START_ to _END_ of _TOTAL_ records", "sInfoEmpty": "Showing 0 to 0 of 0 records", "sInfoFiltered": "(filtered from _MAX_ total records)" }, sPagination: "full_numbers", bStateSave: true, sScorollX: "300px", sScrollY: "200px", oSearch: { "sSearch": "Type here...", "bRegex": false, "bSmart": false } } ); }); </script>

Replies

  • stantor195stantor195 Posts: 4Questions: 0Answers: 0
    It is saying that the error is in the jquery.dataTables.js on line: 6521

    for ( j=0, jLen=oColumn.asSorting.length ; j<jLen ; j++ )
  • larryweyalarryweya Posts: 1Questions: 0Answers: 0
    In my case I was using DataTables with pivot js and the error was because I hadn't setup column headers properly. Through google I've found that it could also be if you are using <td> instead of <th> in your tbales <thead> in my case my <thead><tr> was empty.
  • allanallan Posts: 22,810Questions: 0Answers: 527
    @stantor195 - Can you link us to your page please?

    @larryweya - good to hear you found a solution tot he problem you had. With DataTables 1.9 you should be able to use TH and TD elements interchangeably with DataTables - either should work fine :-)

    Allan
  • allanallan Posts: 22,810Questions: 0Answers: 527
    Cannot connect to server I'm afraid... :-). Is it only up for part of the day?

    Allan
  • d3vkidd3vkid Posts: 1Questions: 0Answers: 0
    This error is generated when no <thead> section is provided. Make sure you have one in your table!
  • OliverRCOliverRC Posts: 2Questions: 0Answers: 0
    I had this problem when I incorrectly defined my aaSorting like this:
    "aaSorting": [0, 'asc'] instead of:
    "aaSorting": [[0, 'asc']]
This discussion has been closed.