Ajax internationalisation breaks sorting when server-side processing.
Ajax internationalisation breaks sorting when server-side processing.
seb_reunion
Posts: 3Questions: 0Answers: 0
Hi,
I just begin to work with your nice datables plugin.
All is working pretty well, a dataTable with server-side processing (because of the large number of rows in database). Sorting & filtering works just fine.
I want to display the french language and here comes the problem. The french language shows up (the xhr call is successfull) but the sorting action is not triggered anymore (No xhr call, no JS error thrown, nothing happen) when i'm using the sUrl, if i use the oLanguage directly, all works fine.
This Works :
[code]
var oTable = $('#listeArticles').dataTable({
"bProcessing": true,
"bServerSide": true,
"sServerMethod": "POST",
//"bStateSave": true,
"sAjaxSource": '/article/listearticle/',
"oLanguage": {
"sProcessing": "Traitement en cours...",
"sSearch": "Rechercher :",
"sLengthMenu": "Afficher _MENU_ éléments",
"sInfo": "Affichage des éléments _START_ à _END_ sur _TOTAL_ éléments",
"sInfoEmpty": "Affichage de l'élément 0 à 0 sur 0 éléments",
"sInfoFiltered": "(filtré de _MAX_ éléments au total)",
"sInfoPostFix": "",
"sLoadingRecords": "Chargement en cours...",
"sZeroRecords": "Aucun élément à afficher",
"sEmptyTable": "Aucune donnée disponible dans le tableau",
"oPaginate": {
"sFirst": "Premier",
"sPrevious": "Précédent",
"sNext": "Suivant",
"sLast": "Dernier"
},
"oAria": {
"sSortAscending": ": activer pour trier la colonne par ordre croissant",
"sSortDescending": ": activer pour trier la colonne par ordre décroissant"
}
}
});
[/code]
This don't work :
[code]
var oTable = $('#listeArticles').dataTable({
"bProcessing": true,
"bServerSide": true,
"sServerMethod": "POST",
//"bStateSave": true,
"sAjaxSource": '/article/listearticle/',
"oLanguage": {
"sUrl": "/data/dataTables.fr.txt"
}
});
[/code]
During my test, i try your example (http://datatables.net/examples/advanced_init/language_file.html). I copy your browser table and i just change your code to have the sUrl linking to my french file and it works (French showing up and sorting still functionnal).
So i'm thinking it's related to the fact that i use a server-side processing.
I also download the "sUrl": "../examples_support/de_DE.txt" you use in your example and i replace my french translation with it, german shows up but sorting do not work anymore.
I compare the 2 html codes when using the sUrl or directly the Olanguage and the only difference is the position: relative on the wrapper div.
[code]
[/code]
I found this thread in the forum, maybe it's related : http://datatables.net/forums/discussion/comment/35260
Any help would be appreciated since duplicating all the translation file all accross my webApp would be hard to maintain.
Thanks again for your work, it's just awesome. Now i have to check the theming aspect, not my cup of tea ;)
Seb
I just begin to work with your nice datables plugin.
All is working pretty well, a dataTable with server-side processing (because of the large number of rows in database). Sorting & filtering works just fine.
I want to display the french language and here comes the problem. The french language shows up (the xhr call is successfull) but the sorting action is not triggered anymore (No xhr call, no JS error thrown, nothing happen) when i'm using the sUrl, if i use the oLanguage directly, all works fine.
This Works :
[code]
var oTable = $('#listeArticles').dataTable({
"bProcessing": true,
"bServerSide": true,
"sServerMethod": "POST",
//"bStateSave": true,
"sAjaxSource": '/article/listearticle/',
"oLanguage": {
"sProcessing": "Traitement en cours...",
"sSearch": "Rechercher :",
"sLengthMenu": "Afficher _MENU_ éléments",
"sInfo": "Affichage des éléments _START_ à _END_ sur _TOTAL_ éléments",
"sInfoEmpty": "Affichage de l'élément 0 à 0 sur 0 éléments",
"sInfoFiltered": "(filtré de _MAX_ éléments au total)",
"sInfoPostFix": "",
"sLoadingRecords": "Chargement en cours...",
"sZeroRecords": "Aucun élément à afficher",
"sEmptyTable": "Aucune donnée disponible dans le tableau",
"oPaginate": {
"sFirst": "Premier",
"sPrevious": "Précédent",
"sNext": "Suivant",
"sLast": "Dernier"
},
"oAria": {
"sSortAscending": ": activer pour trier la colonne par ordre croissant",
"sSortDescending": ": activer pour trier la colonne par ordre décroissant"
}
}
});
[/code]
This don't work :
[code]
var oTable = $('#listeArticles').dataTable({
"bProcessing": true,
"bServerSide": true,
"sServerMethod": "POST",
//"bStateSave": true,
"sAjaxSource": '/article/listearticle/',
"oLanguage": {
"sUrl": "/data/dataTables.fr.txt"
}
});
[/code]
During my test, i try your example (http://datatables.net/examples/advanced_init/language_file.html). I copy your browser table and i just change your code to have the sUrl linking to my french file and it works (French showing up and sorting still functionnal).
So i'm thinking it's related to the fact that i use a server-side processing.
I also download the "sUrl": "../examples_support/de_DE.txt" you use in your example and i replace my french translation with it, german shows up but sorting do not work anymore.
I compare the 2 html codes when using the sUrl or directly the Olanguage and the only difference is the position: relative on the wrapper div.
[code]
[/code]
I found this thread in the forum, maybe it's related : http://datatables.net/forums/discussion/comment/35260
Any help would be appreciated since duplicating all the translation file all accross my webApp would be hard to maintain.
Thanks again for your work, it's just awesome. Now i have to check the theming aspect, not my cup of tea ;)
Seb
This discussion has been closed.
Replies
Allan
I've made this code, sorry i had to use your server-side script & language file because mine are not online.
To make this work, i had to allow cross site xhr request adding the following argument to my chrome launcher : --disable-web-security
All this work to see that indeed, like u say, it works very well ;)
Because i made so many changes since i post the first message, here's the situation now :
[code]
var oTable = $('#listeArticles').dataTable({
"fnFormatNumber": function ( iIn ) {
if ( iIn < 1000 ) {
return iIn;
} else {
var
s=(iIn+""),
a=s.split(""), out="",
iLen=s.length;
for ( var i=0 ; i
I've also added FixedHeader here: http://live.datatables.net/igalob/14/edit . I've put it into fnInitComplete which is fired when the data has been loaded from the server.
Allan
I've also added FixedHeader here: http://live.datatables.net/igalob/14/edit . I've put it into fnInitComplete which is fired when the data has been loaded from the server.
Allan[/quote]
Thank u very much, all is woring perfectly now !
Seems that loading the language file asynchronously may lead to problem with plugin calls which are not bind to the completion of the initialisation. Maybe this could be added in the documentation of such plugins...
Thx again for your GREAT work and for your time use to explain it to me :)