Zero configuration example not working?

Zero configuration example not working?

Rapid1898Rapid1898 Posts: 27Questions: 8Answers: 0

Hello - i try to locally rebuild the first example - https://datatables.net/examples/basic_init/zero_configuration.html

I created an index.html like in the example and tried to link the mentioned css and js files:
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css">
...
<table like in the example...>
...
<script type="text/javascript" src="js/main.js"></script>
<script type="text/javascript" charset="utf8" src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js"></script>

The main.js look like in the example:
$(document).ready(function() {
$('#example').DataTable();
} );

It works but i only get the plain table without any formatting, search field, show entries, page handling etc.

What i am doing here wrong?

Answers

  • tangerinetangerine Posts: 3,342Questions: 35Answers: 394

    What is "main.js"?
    If it is your DT configuration, it must be loaded after the DT js file.

  • Rapid1898Rapid1898 Posts: 27Questions: 8Answers: 0

    yes - thanks - this was exactly the problem - now it works!

This discussion has been closed.