You have a mixture of different scripts in your header, which need to be cleaned up.
For example, you have:
https://cdn.datatables.net/1.10.23/js/jquery.dataTables.min.js (deferred)
But you also have:
https://cdn.datatables.net/1.10.22/js/jquery.dataTables.js
Also, when I run your code and open my browser's console (e.g. via F11), I can see the following error:
Uncaught TypeError: i.Buttons is undefined
Does the following script exist? And is it in the right location to be accessed by your page?
~/Scripts/DataTables/dataTables.buttons.js
You also tagged your question as a bootstrap-4
question - but I do not see any Bootstrap-related libraries on your page.
Suggestion:
Your DataTables code looks OK. But I would remove all those JS and CSS imports and start again.
Go to the DataTables download builder page and select the libraries you want.
For example if I ignore Bootstrap (just for this demo), and if I choose plain DataTables with jQuery and buttons, I get the following:
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.23/css/jquery.dataTables.min.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.6.5/css/buttons.dataTables.min.css"/>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.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.10.23/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.5/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.5/js/buttons.colVis.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.5/js/buttons.flash.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.5/js/buttons.html5.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.5/js/buttons.print.min.js"></script>
Using these with your code allows your buttons to be displayed.
You can add back in the extra libraries you also want - for exaple, for moment.js
. You can adjust for Bootstrap, also, as needed.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…