there is an issue with decimal language option

there is an issue with decimal language option

ssy341ssy341 Posts: 15Questions: 0Answers: 0

Hi,all,

if I use below code:

language:{
  "decimal": "-",
    "thousands": "."
}

it can be throw error in console: fn is not a function
there are details:

jquery.dataTables.js:5993 Uncaught TypeError: fn is not a function
(anonymous function) @ jquery.dataTables.js:5993
_fnSort @ jquery.dataTables.js:5979
_fnReDraw @ jquery.dataTables.js:3513
_fnInitialise @ jquery.dataTables.js:4708
options.each.$.ajax.success @ jquery.dataTables.js:1117
fire @ jquery-2.0.0.js:2863
self.fireWith @ jquery-2.0.0.js:2975
done @ jquery-2.0.0.js:7329
(anonymous function) @ jquery-2.0.0.js:7751

I look at the code at line 5993 (jquery.dataTables.js)

displayMaster.sort( function ( a, b ) {
                    var
                        x, y, k, l, test, sort, fn,
                        len=aSort.length,
                        dataA = aoData[a]._aSortData,
                        dataB = aoData[b]._aSortData;
    
                    for ( k=0 ; k<len ; k++ ) {
                        sort = aSort[k];
    
                        x = dataA[ sort.col ];
                        y = dataB[ sort.col ];
    
                                                 //I debug this line, the value of sort.type is 'num-'
                                                 //so, the final string like this "num--asc"
                                                 // then,next code throw error : fn is not a function
                        fn = oExtSort[ sort.type+"-"+sort.dir ] || oExtSort[ "string-"+sort.dir ];
                        test = fn( x, y );
                        if ( test !== 0 ) {
                            return test;
                        }
                    }
    
                    x = aiOrig[a];
                    y = aiOrig[b];
                    return x<y ? -1 : x>y ? 1 : 0;
                } );

I want to make a demo to show the problem again, but the project is complex. I don't know how to solve the problem.But, If I remove the [ "decimal": "-",] option, the code is can be work.

Replies

This discussion has been closed.