1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-01-18 11:52:11 +01:00

Fix DataTables/DataTables #291 - non-string data support for non-'.' dec

numbers
This commit is contained in:
Allan Jardine 2014-03-28 08:21:54 +00:00
parent 6a033ad09b
commit 09bf9b200c
2 changed files with 6 additions and 2 deletions

View File

@ -1 +1 @@
46d1f3bbf2385d6918482953c6b3ee5ff64ba988
59aab63cae6169f1a282e23c493a1f758a2ce34d

View File

@ -124,12 +124,16 @@
return !isNaN(integer) && isFinite(s) ? integer : null;
};
// Convert from a formatted number with characters other than `.` as the
// decimal place, to a Javascript number
var _numToDecimal = function ( num, decimalPoint ) {
// Cache created regular expressions for speed as this function is called often
if ( ! _re_dic[ decimalPoint ] ) {
_re_dic[ decimalPoint ] = new RegExp( _fnEscapeRegex( decimalPoint ), 'g' );
}
return num.replace( /\./g, '' ).replace( _re_dic[ decimalPoint ], '.' );
return typeof num === 'string' ?
num.replace( /\./g, '' ).replace( _re_dic[ decimalPoint ], '.' ) :
num;
};