Datatable Language URL doesn'T work for local Files
Datatable Language URL doesn'T work for local Files
Hello,
the DataTable i'm using doesn'T load the local json-Language Files. Using the URL to the CDN Files work. To clean out the TAG for "sSearch" i have to use my own language Files....
My environment:
Visual Studio 13
ASP.net
JQ 2.1.3
DTables.JS 1.10.5
Code:
var InitiateEditableDataTable = function () {
return {
init: function (ptabledata, lang) {
var dtout = ptabledata;
}
//Datatable Initiating
var oTable = $('#editabledatatable').dataTable({
"data": dtout,
"autoWidth": false,
"aoColumns": [
{ "mDataProp": "Field1"},
{ "mDataProp": "Field1_TYPE" },
{ "mDataProp": "Field2" },
{ "mDataProp": "Field3" },
{
data: null,
bSortable: false,
defaultContent: '<a href="#" class="btn btn-info btn-xs edit"><i class="fa fa-edit"></i> Edit</a>'
}
],
"aLengthMenu": [
[5, 15, 20, 100, -1],
[5, 15, 20, 100, "All"]
],
"bSort": true,
"iDisplayLength": 5,
"sPaginationType": "bootstrap",
"sDom": "flt<'row DTTTFooter'<'col-sm-6'i><'col-sm-6'p>>",
"language": {
"url": "/Config/Localization/dataTables/German.lang"
},
//works
//"language": {
// "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/German.json"
//}
});
Answers
Json
{
"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": "",
"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"
}
}
Browser's don't allow Ajax requests to get local files using
file://
. Doing so would be a massive security hole. This is not a limitation of DataTables, but a security restriction in browsers.Allan
okay - I have not expressed myself clearly.
The File isn't really lokal. It is part of the Package like every image etc. which is used for the Frontend.
referring to this post on another forum
http://stackoverflow.com/questions/13342494/how-to-change-language-for-datatable
I understand now. Thanks for linking to the SO thread with the answer.
Allan