Initialisation
Initialisation
evpf29b
Posts: 6Questions: 4Answers: 0
Bonjour
Je ne comprends plus rien.
tableau.js
$(document).ready(function () {
$('#tab').DataTable({
"scrollY": 440,
"scrollX": true,
select: true,
dom: 'lftrip',
pagingType: "full_numbers",
order:[2, 'asc'],
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
lengthMenu:[5,10,15,20,25],
pageLength: 15,
language: {
url: "French.json"
}
});
});
lecture.php
<html>
<head>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
<script type="text/javascript" src="tableau-fichier.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.12.1/css/jquery.dataTables.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.dataTables.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/searchpanes/2.0.2/css/searchPanes.dataTables.css"/>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/searchpanes/2.0.2/js/dataTables.searchPanes.js"></script>
etc.....
rien ne passe, pas de boutons, pas de modification de l'aspect de mon tableau.
En fait quoi que je modifie comme script il n'est pas pris en compte.
Merci de votre aide.
Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide
This question has an accepted answers - jump to answer
Answers
First you need to tell Datatables to display the buttons as described here. The easiest is to add
B
to thedom
option. You need to do the same for SearchPanes as described here by addingP
to thedom
option.It doesn't look like you are loading
jszip.js
which is required for Excel export. Use the Download Builder to get all the files you need.Kevin
merci beaucoup c'est parfait