I try to init DataTable but can't.
<style type="text/css" title="currentStyle">
@import "demo_page.css";
@import "demo_table.css";
</style>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.dataTables.js"></script>
What is wrong?
Is structure of table required?
Is data required?
<table id="example"> <thead> <tr> <th>Column 1</th> </tr> </thead> <tbody> <tr> <td>data</td> </tr> </tbody> </table>
You need only two files to initialize:
Your table will look crazy without appropriate CSS, (various spans are added to facilitate the sorting icons), but they're not necessary. They're just style.
If it's not initializing with those two files and a $('#myTable').dataTable()
call (in the document ready function) then something else is going on and you will need to look at your JavaScript console to see what errors are being thrown.
Here it is in their jsbin environment: http://live.datatables.net/olofeg
No CSS, just the two JS files, a well-formed table, and calling dataTable()
from the document ready function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With