mirror of
https://github.com/DataTables/DataTables.git
synced 2025-03-15 16:29:16 +01:00
Fix: number
renderer displayed numbers incorrectly for negative numbers
This commit is contained in:
parent
4447b84c34
commit
c38e140a52
@ -1 +1 @@
|
|||||||
1fcedce42d4cb20dfa1e82e6bf7f9f871baac309
|
89ab148ad45a219c2623fcc75b15a59b7d0c7a2e
|
||||||
|
6
media/js/jquery.dataTables.js
vendored
6
media/js/jquery.dataTables.js
vendored
@ -14139,13 +14139,15 @@
|
|||||||
number: function ( thousands, decimal, precision, prefix ) {
|
number: function ( thousands, decimal, precision, prefix ) {
|
||||||
return {
|
return {
|
||||||
display: function ( d ) {
|
display: function ( d ) {
|
||||||
d = parseFloat( d );
|
var negative = d < 0 ? '-' : '';
|
||||||
|
d = Math.abs( parseFloat( d ) );
|
||||||
|
|
||||||
var intPart = parseInt( d, 10 );
|
var intPart = parseInt( d, 10 );
|
||||||
var floatPart = precision ?
|
var floatPart = precision ?
|
||||||
decimal+(d - intPart).toFixed( precision ).substring( 2 ):
|
decimal+(d - intPart).toFixed( precision ).substring( 2 ):
|
||||||
'';
|
'';
|
||||||
|
|
||||||
return (prefix||'') +
|
return negative + (prefix||'') +
|
||||||
intPart.toString().replace(
|
intPart.toString().replace(
|
||||||
/\B(?=(\d{3})+(?!\d))/g, thousands
|
/\B(?=(\d{3})+(?!\d))/g, thousands
|
||||||
) +
|
) +
|
||||||
|
Loading…
x
Reference in New Issue
Block a user