Erreurs rencontrées avec DataTables
Bonjour à tous,
Je rencontre plusieurs erreurs avec DataTables avec le code source suivant:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| <!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Gestion documentation</title>
<meta name="description" content="Outil de gestion de documentation">
<meta name="author" content="Marc Paris (moimp)">
<meta http-equiv="Expires" content="-1" >
<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css">
<script src="js/list.js"></script>
<base href="http://itdocs/">
<link rel="stylesheet" media="all" type="text/css" href="css/main.css">
<script>const lang = "fr";</script>
<script src='js/lang/fr.js'></script>
<script type='module' src='js/clock.js'></script>
</head>
<body>
<header>
<div class="displTimer">
<span id="timer"></span> </div>
<h1>Gestionnaire de documentation</h1>
</header>
<div class="mainSection">
<div id="left">
<nav>
<ul>
<li><a href="index.php?page=list">Liste</a></li>
<li><a href="index.php?page=editDoc">Edition document</a></li>
<li><a href="index.php?page=editCategory">Edition catégorie</a></li>
<li><a href="index.php?page=list">Liste</a></li>
<li><a href="index.php?page=list">Liste</a></li>
</ul>
</nav>
</div> <article id="right">
<h3>Liste des documents répertoriés</h3>
<table id="table">
<thead><tr><th>Sujet</th><th>Titre</th><th>Catégorie</th><th>Catégorie 2</th><th>Emplacement</th><th>Mots clefs</th><th>Mise à jour</th></tr></thead>
<tbody>
<tr><td>cellule 1</td><td>cellule 2</td><td>cellule 3</td><td>cellule 4</td><td>cellule 5</td><td>cellule 6</td><td>cellule 7</td></tr>
</tbody>
<tfoot><tr><th>Sujet</th><th>Titre</th><th>Catégorie</th><th>Catégorie 2</th><th>Emplacement</th><th>Mots clefs</th><th>Mise à jour</th></tr></tfoot>
</table>
</article>
</div>
</body>
</html> |
Code du fichier "js/list.js":
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| $(document).ready(function() { // executed when document is loaded
//$.fn.dataTable.ext.order.intl('fr'); // french collation, see also https://stackoverflow.com/questions/69004579/in-my-datatable-i-have-a-simple-column-containing-only-simple-strings-but-its
let table = new DataTable('#table',{
language: {
url: "view/lang/fr_dataTables.json",
},
initComplete: function() {
$('#table_filter [type="search"]').focus();
}
});
}); |
Les erreurs sont les suivantes:
Citation:
Uncaught ReferenceError: DataTable is not defined
at HTMLDocument.<anonymous> (list.js:5:14)
at mightThrow (jquery-3.4.1.js:3557:29)
at process (jquery-3.4.1.js:3625:12)
A quoi correspondent ces erreurs et comment y remédier?