0
<table></table>

<script>

$(function () {
    $('table').each(function () {
        $(this).DataTable(
               {

                   stateSave: true,
                   "sDom": 'C<"clear">rfrtip',
                   "scrollCollapse": true,
                   "paging": true,
                   responsive: true
            });

    });

});

Occurring error:

 Uncaught TypeError: Cannot read property 'aDataSort' of undefined<br/>
         at _fnSortFlatten (jquery.dataTables.js:5889)<br/>
         at _fnSortingClasses (jquery.dataTables.js:6227)<br/>
         at loadedInit (jquery.dataTables.js:1234)<br/>
         at loaded (jquery.dataTables.js:6341)<br/>
         at _fnLoadState (jquery.dataTables.js:6425)<br/>
         at HTMLTableElement.<anonymous> (jquery.dataTables.js:1329)<br/>
         at Function.each (jquery.min.js:2)<br/>
         at w.fn.init.each (jquery.min.js:2)<br/>
         at w.fn.init.DataTable [as dataTable] (jquery.dataTables.js:869)<br/>
         at w.fn.init.$.fn.DataTable (jquery.dataTables.js:15172)

I also tried

<table><thead></thead><tbody></tbody></table>

EDIT : How to fix this without filling thead?

piet.t
  • 11,718
  • 21
  • 43
  • 52
Ofek Ron
  • 8,354
  • 13
  • 55
  • 103
  • May be this answer is your solution, https://stackoverflow.com/a/32476369/1578380 – Chintan7027 May 08 '18 at 04:47
  • 1
    Possible duplicate of [JQuery Datatables : Cannot read property 'aDataSort' of undefined](https://stackoverflow.com/questions/28454203/jquery-datatables-cannot-read-property-adatasort-of-undefined) – mmushtaq May 08 '18 at 04:48
  • DataTables 1.10.9 will not check for bounds. Oliver's suggestion fixes this bug: https://stackoverflow.com/questions/28454203/jquery-datatables-cannot-read-property-adatasort-of-undefined/32476369#49822492 – Xtopher Dec 06 '18 at 19:10

0 Answers0