How to implement interntionalization for jquery.datatable.min.js?
How to implement interntionalization for jquery.datatable.min.js?
suprithasraoa
Posts: 12Questions: 1Answers: 0
We have tried following code but it does not work.
$(document).ready(function () { $('#myTable').dataTable({ "language": { "url": "datatables-ch-zhs.json")" } }); });We need to implement this on jquery.datatable.min.js
This discussion has been closed.
Answers
Do you actually have that file on your system?
And what does it contain? Does the console in your browser show anything?
Thanks,
Allan
Yes I have that file in the same folder where cshtml resides. It contains following:
{
"sProcessing": "处理中...",
"sLengthMenu": "显示 MENU 项结果",
"sZeroRecords": "没有匹配结果",
"sInfo": "显示第 START 至 END 项结果,共 TOTAL 项",
"sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
"sInfoFiltered": "(由 MAX 项结果过滤)",
"sInfoPostFix": "",
"sSearch": "搜索:",
"sUrl": "",
"sEmptyTable": "表中数据为空",
"sLoadingRecords": "载入中...",
"sInfoThousands": ",",
"oPaginate": {
"sFirst": "首页",
"sPrevious": "上页",
"sNext": "下页",
"sLast": "末页"
},
"oAria": {
"sSortAscending": ": 以升序排列此列",
"sSortDescending": ": 以降序排列此列"
}
}
Browser shows default English which is hard coded in .js file
I am using jquery.datatable.min.js not jquery.datatable.js. In jquery.datatable.min.js "Showing 0 to 0 of 0 entries" is hard coded I guess
Even with jquery.datatable.js it takes default English
This example shows it working correctly. You'd need to give us a link to a page showing the issue, or create a test case showing the issue, so we can offer any support with it.
Allan
This example does not work in cshtml page.
We have implemented datatable Version 1.8.2. in cshtml file. When we try to implement interntionalization of datatable , it does not work.
1.8.2 is very old and no longer supported. 1.10.16 is the current release, which you can download from here.
Allan
Hi Allan,
What is the minimum version that would work with internationalisation?
1.8.2 can be used with internationalisation. Documentation for it is here.
Allan
Hi Allan,
We are on 1.8.2
Our Table structure is as follows:
We added following code for Internationalization:
It does not load the table.
Can you please adv us on where are we wrong?
Please also advise us on upgrading it to 1.10.16. Which all js files have to be upgraded to which version?
Just by including https://code.jquery.com/jquery-1.12.4.js and replacing jquery.dataTables.min.js with 1.10.16 version did not work.
Your code looks fine to me - I'd need a link to a test case showing the issue to be able to help.
Upgrade documentation is available here. Yes, you should just need to update the DataTables JS file. Again, if that doesn't work for you I would need a link to a page showing the issue.
Allan
Hi Allan,
I found out the real issue.
Our Datatable is wrapped inside script block:
So the following JQuery Script is not getting the table. If we remove Script block, Internationalisation works. But Script block is required to get data from database.
We tried following which did not work:
Can you please adv?
That would really be a question for the maintainer of whatever templating library you are using. I've not seen HTML inside a
script
tag before like that.Allan
Hi Allan,
Any datatable object added to the DOM via another script cannot be accessed by jscirpt?
Can you advise on how to address this?
Thanks
This is how data is populated in the datatable.
I'm afraid I don't really understand the question.
row().node()
can be used to get the row node(s).Allan