Reputation: 15047
I am trying to implement language file in this original code from datatables documentation which shows as follows :
$(document).ready(function() {
var table = $('#example').DataTable( {
lengthChange: false,
buttons: [ 'copy', 'excel', 'pdf', 'colvis' ]
} );
table.buttons().container()
.appendTo( '#example_wrapper .col-sm-6:eq(0)' );
} );
but when i put the language file location the buttons are gone...and i get an error in console: not well-formed
How to fix this?
this is what i have tried
$(document).ready(function() {
var table = $('#example').DataTable({
"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "Alle"]],
responsive: true,
buttons: [
{
extend: 'copyHtml5',
exportOptions: {
columns: [ 0, ':visible' ]
}
},
{
extend: 'excelHtml5',
title: 'Events export'
},
{
extend: 'pdfHtml5',
title: 'Events export'
},
'colvis',
],
"language": {"url": "/vendor/datatables/german.js"}
});
table.buttons().container()
.appendTo( '#example_wrapper .col-sm-6:eq(0)' );
});
Upvotes: 0
Views: 886
Reputation: 358
Just replace
"language": {
"url" : "js/german.json",
}
with
language: {
"sEmptyTable": "Keine Daten in der Tabelle vorhanden",
"sInfo": "_START_ bis _END_ von _TOTAL_ Einträgen",
"sInfoEmpty": "0 bis 0 von 0 Einträgen",
"sInfoFiltered": "(gefiltert von _MAX_ Einträgen)",
"sInfoPostFix": "",
"sInfoThousands": ".",
"sLengthMenu": "_MENU_ Einträge anzeigen",
"sLoadingRecords": "Wird geladen...",
"sProcessing": "Bitte warten...",
"sSearch": "Suchen",
"sZeroRecords": "Keine Einträge vorhanden.",
"oPaginate": {
"sFirst": "Erste",
"sPrevious": "Zurück",
"sNext": "Nächste",
"sLast": "Letzte"
},
"oAria": {
"sSortAscending": ": aktivieren, um Spalte aufsteigend zu sortieren",
"sSortDescending": ": aktivieren, um Spalte absteigend zu sortieren"
}
}
Upvotes: 1