Buttons in not showing with French translation
Buttons in not showing with French translation
Hi all,
I tried to use the French translation, all fine everything is translated but I lost my buttons.
Like this is ok:
$("#example1").DataTable({
"responsive": true,
"lengthChange": false,
"pageLength": 50,
"autoWidth": false,
"buttons": ["excel", "pdf", "print", "colvis"]
}).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');
when I apply the French CDN buttons are not shown anymore:
$("#example1").DataTable({
language: {
url: '//cdn.datatables.net/plug-ins/1.13.7/i18n/fr-FR.json'
},
"responsive": true,
"lengthChange": false,
"pageLength": 50,
"autoWidth": false,
"buttons": ["excel", "pdf", "print", "colvis"]
}).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');
I didn't change anything else. Does someone has a clue?
THanks in advance,
BR
Diogo
Replies
I think it has to do with the asynchronous ajax request for the language CDN. The response hasn't returned. See this note in the
ajax.url
docs:It works moving the buttons insert code into
initComplete
:https://live.datatables.net/malunice/1/edit
Kevin
Hi,
Thanks for your answer, unfortunately, it didn't solve my problem. I applied the same code as you mentioned with the initComplete option but it does not work. I have no errors on the console as well, I have no flags to start digging.
Like this no problem at all. But
Some how is not appending the buttons. I go crazy
BR
Diogo
You didn't move the buttons insertion code into
initComplete
as my example shows. Here is the code from the example:Kevin
Yep, it still doesn't work. But I think Kevin gave you some good advice.
You need to use "initComplete" to make sure the language file loading will have completed when appending the buttons. Take a look at his example. Here is the relevant code:
When I tried it the first time:
.appendTo('#example_wrapper =>> should be example1
My fault now it's working like a charm, thanks guys!
BR
Diogo