oAria is undefined
oAria is undefined
JML86
Posts: 5Questions: 0Answers: 0
Hi,
I use DataTables version 1.9.4. I want that the initial sorting is made on the column 8.
oTable.fnSort( [ [8,'desc'] ] ) works well, but sends back an error in Javascript console of Firefox ( oAria is undefine ) and stops the continuation of the JavaScript.
For information : jquery.datatTbles.js line 4082: (aoColumns[i].asSorting[0]=="asc" ? oAria.sSortAscending : oAria.sSortDescending) )
DataTables debugger does not indicate the error
Regards,
I use DataTables version 1.9.4. I want that the initial sorting is made on the column 8.
oTable.fnSort( [ [8,'desc'] ] ) works well, but sends back an error in Javascript console of Firefox ( oAria is undefine ) and stops the continuation of the JavaScript.
For information : jquery.datatTbles.js line 4082: (aoColumns[i].asSorting[0]=="asc" ? oAria.sSortAscending : oAria.sSortDescending) )
DataTables debugger does not indicate the error
Regards,
This discussion has been closed.
Replies
Allan
Here is the code. It works with "fnSort" but the script is stopped (no Alert).
[code]
$(document).ready(function() {
/**************************** dataTables *******************************************/
// Trier les dates FR
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"date-fr-pre": function ( a ) {
var frDatea = a.split('/');
return (frDatea[2] + frDatea[1] + frDatea[0]) * 1;
},
"date-fr-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"date-fr-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
});
// dataTables
var oTable = $(".main").dataTable({
"oLanguage": {"sUrl": "../jquery-ui/js/datatables_fr.txt"},
//"asStripeClasses": ['dossier'],
"bSortClasses": true,
//"aaSorting": [[8,'desc']],
"aoColumns": [{ "sType": "date-fr" },null,null,null,null,null,null,null,null,null] ,
"aoColumnDefs": [{"iDataSort": 3, "aTargets": [ 2 ] }] ,
//"bDestroy": true,
//"bRetrieve": true,
"bJQueryUI": true,
"bScrollCollapse": true,
"sScrollY": "700px",
"bAutoWidth": true,
"bPaginate": true,
"sPaginationType": "full_numbers", //full_numbers,two_button
"bStateSave": true,
"bInfo": true,
"bFilter": true,
"iDisplayLength": 15,
"bLengthChange": true,
"aLengthMenu": [[10, 15, 50, 100, -1], [10, 15, 50, 100, "Tous"]]
});
oTable.fnSort( [ [8,'asc'] ] );
alert("OK if fnSort is commented"); //no alert !
/********************************** Choix du dossier *******************************/
$(".dossier").mouseover(function() {
$(this).css("background", "#FFFFDD");
//$(this).css("color", "#990066");
$(this).css("color", "#990000");
});
.................................
..............................
});
[/code]
Regards,
- oLanguage is commented (Language by default)
[code]
var oTable = $(".main").dataTable({
//"oLanguage": {"sUrl": "../jquery-ui/js/datatables_fr.txt"},
"bSortClasses": true,
etc ...
[/code]
- or the content of file datatables_fr.txt is only copied in oLanguage (In French)
[code]
var oTable = $(".main").dataTable({
"oLanguage": {
"oAria": {
"sSortAscending": ": activer pour trier ..",
"sSortDescending": ": activer pour trier .."
},
"oPaginate": {
"sFirst": "<<",
etc ...
[/code]
I don't understand ...
PS : Error in Javascript console of Firefox ( oAria is undefine ) is before loading datatables_fr.txt
Regards,
With setTimeout(), there is not error anymore :
[code]
oTable = $(".main").dataTable({
/* Version francçaise */
"oLanguage": {"sUrl": "../jquery-ui/js/datatables_fr.txt"},
"asStripeClasses": [],
etc ...
});
setTimeout("oTable.fnSort( [ [8,'asc'] ,[0,'desc']])",1000);
etc ...
[/code]
But I look for a better solution because setTimeout() is random (how many ms ?).
An idea ?
Regards,
Allan
JML
Any help is greatly appreciated!
Allan
http://live.datatables.net/ikocah/
Allan
By the way, when I move the oLanguage strings into my HTML page, it works fine...
No idea - I haven't tried that. Row grouping is a third party plug-in that is not supported by myself. If you've narrowed the problem down to that plug-in, I'd suggest opening an issue in that plug-in's project. Providing a test test will help with any debugging I'm sure.
Allan
[quote]Does it also work if you enable rowGrouping?[/quote]
I saw your problem with rowGrouping trying to find the solution myself, I'm not sure if it's the best way but like allan said you should use the fnInitComplete function, like this:
[code]
"fnInitComplete": function (oSettings, json) {
this.rowGrouping({
//options
});
}
[/code]
That should get rid of the error.
Hope this helps
However, I have been hit by exactly the same issue as reported above, and as yet, cannot find an answer. Same symptoms: using datatables 1.9.4 - oAria is undefined. Commenting out all oLanguage settings and it goes away. I am using internationalization by calling a custom AJAX controller server side and effectively passing back the same JSON response as the language files (including oAria part) for English and Japanese. I am not doing anything fancy, just standard settings, Client side processing.
As reported above, the problem appears in Firefox. Actually, I don't see the issue with Chrome. Used your online debugger to check everything but it didn't identify any issues. This comment is for you and anyone else out there who might get this issue. Looks very much like a bug rather than an incorrect configuration setting at this point in time. I will update the post if I manage to discover its cause.
Allan
then this error occurs (in my example that is): So
[code]
$.extend($.fn.dataTable.defaults, {
"oLanguage": {
"sUrl": "de_DE.txt"
}
});
$('#example').dataTable( {
"bSort" : true
});
[/code]