Issue: Column Search broken when using ajax i18n
Issue: Column Search broken when using ajax i18n
I added column search using the following snippet and everything works fine:
table.columns().every(function(){
var that = this;
$( 'input', this.footer() ).on( 'keyup change', function(){
that.search( this.value ).draw();
});
});
However, when I ask Datatables to load i18n resources by ajax, the search is broken:
The text entered in one html search box is replicated in all of them (not visually, but in the request sent to server).
language: {
url: "/server/resources/datatables/i18n/en.json",
}
Thus, when I remove the language object, the search behaves as expected.
Context: server side datatables V1.10.7 / same issue in Firefox and in Chrome on Ubuntu
(Thanks Allan for this superb product)
This question has an accepted answers - jump to answer
Answers
This might not be the answer you want, but it does shed a little light:
https://datatables.net/forums/discussion/26977/i18n-plugin-files-are-not-in-json-format
The json language files were copied from the official site and they are correctly interpreted.
Without a link to the page (as per the forum rules) it is difficult to say for certain, but my guess is that you need to move the filter initialisation into
initComplete. The reason for this is that loading a language file via Ajax makes the initialisation of the DataTable asynchronous.Allan
Thanks Allan. This solved my problem.