How can I configure language and options?
How can I configure language and options?
lat94
Posts: 11Questions: 2Answers: 0
I can't figure out where to put the Data Table translations/options settings.
I am getting an error (obviously) of "reinitialize" the table, which completely makes sense.
Can somebody help me?
Code untill now:
$(document).ready(function(){
$('#myTable').DataTable({
"language": {
"url": "http://cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Portuguese-Brasil.json"
}
});
});
$(document).ready(function(){
$('#myTable').DataTable({
"lengthMenu": false,
"bLengthChange": false,
"scrollX": true
});
});
error:
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Did you read through the tech note linked in the error?
https://datatables.net/manual/tech-notes/3
The tech note has the answer. Post back if it doesn't help.
Kevin
Yes, I did already checked this link. And it is not working with the parameter "retrieve: true".
Thanks for answering!
You need to combine the initialization parameters into one, like this:
Otherwise the second one will cause the reinitialization error.
Kevin
Why don't you put the "language" initialisation into your second block of code, and then scrap your first block?
@kthorngren , I already tried this way and won't work
code:
Error:
@tangerine , could you elaborate some code to exemplify, please?
My answer is the same as @kthorngren's answer.
Your code works here:
http://live.datatables.net/recidesu/1/edit
Can you post a link to your page showing the issue?
Kevin
@kthorngren yeah your code is working and that's really weird
Here is my code (not working after inserting "language": https://jsfiddle.net/t6n2u5sx/1/
I was able to get your code working here too. But when I put bootstrap-4 styling it gives the error mentioned above > "Uncaught TypeError: h.ajax is not a function"
Bootstrap 4 styling:
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/dataTables.bootstrap4.min.css">
I'm having the same problem with bootstrap4
Found this SO thread. You are using this:
Sounds like you do not want to use the
slim
version. BTW you also are loading jQuery at the top of the fiddle. You will only want to load it once.Kevin
@kthorngren yeah, about the slim version I forgot to take it off of my copy version which I uploaded to jsfiddle.
Anyway, I've managed to get it done with you guys helping me, thanks!
Code with DataTable working exactly how I want to:
live.datatables.net/jijurapu/1/edit
@lat94 works like a charm, thank you!