Bug with Internationalisation

Bug with Internationalisation

kelukelu Posts: 4Questions: 1Answers: 0
edited August 2014 in Free community support

I got this error: TypeError: oAria is undefined (the error is in 4590 line of jquery.dataTables.js file version 1.10.2)

It happens when I use internationalisation like this one: http://www.datatables.net/plug-ins/i18n/Polish

I use version 1.10.2 and it happens also on 1.9.4 as far as I checked.

The bug happens when I use a function oTable.fnSort( [ [5,'desc'] ] ); to sort some column by default.

My code is here: http://jsfiddle.net/uszt9xyy/

$(document).ready(function() {
    var oTable = $('#example').dataTable({
        oLanguage: {
            "sUrl": "data_tables.txt"
        }
    });
    oTable.fnSort( [ [4,'desc'] ] );
} );

Here is live "working" version: http://kelostrada.pl/upload/test.html

This question has accepted answers - jump to:

Answers

  • kelukelu Posts: 4Questions: 1Answers: 0

    @up - I think it's a proper bug report, so please look into it.

  • allanallan Posts: 63,552Questions: 1Answers: 10,477 Site admin
    Answer ✓

    The problem is that you are calling fnSort before the Ajax language file has been loaded. What you should do is use initComplete:

    $(document).ready(function() {
        var oTable = $('#example').dataTable({
            oLanguage: {
                "sUrl": "data_tables.txt"
            },
            initComplete: function () {
                 oTable.fnSort( [ [4,'desc'] ] );   
            }
        });
    } );
    

    Or better yet, it you want to set a default sort, just use the order option:

    $(document).ready(function() {
        var oTable = $('#example').dataTable({
            oLanguage: {
                "sUrl": "data_tables.txt"
            },
            order: [ [4,'desc'] ]
        });
    } );
    

    Allan

  • kelukelu Posts: 4Questions: 1Answers: 0

    My bad then, sorry and thank you :) I think order doesn't work in 1.9.x

  • allanallan Posts: 63,552Questions: 1Answers: 10,477 Site admin
    Answer ✓

    No - in 1.9- it was called aaSorting .

    Allan

  • kelukelu Posts: 4Questions: 1Answers: 0

    Oh thank you, I was looking for that.

This discussion has been closed.