i am working on pagination and i am using DataTables plugin , on some tables it\'s work but on some tables it gives error:
Uncaught TypeError: Cannot
I had faced a similar issue when binding data table to a .Net GridView if grid view did not have any data and no header values defined then it was throwing:
Uncaught TypeError: Cannot read property 'aDataSort' of undefined
Below was the code for the same.
$("#GridView1").prepend($("").append($("#GridView1").find("tr:first"))).dataTable();
$("#GridView1").dataTable();
I guess you are also facing the same issue, as you are also getting the table header names dynamically and if the result for it is null or empty then you are getting the mentioned error. Therefore, either you try giving column names when binding it to data table or make sure that your PHP code always returns some data for the table header.
- 热议问题