Formatting

jQuery Calx depends on numeral.js for output formatting. In jQuery Calx version 1.x , numeral is integrated into the core, but no longer integrated in jQuery Calx 2.x and listed as dependency, you need to load it before loading jQuery Calx if you need the formatting feature.

Setting up locale

In jQuery Calx 1.x, locale settings are defined inside the jQuery Calx configuration, since jQuery Calx 2 no longer integrated with numeral.js, local settings are defined in numeral config

Formatting Value

Cell value formatting is defined in the data-format attribute using pre-defined rule, below is example of how to format the cell value and list of available formatting rules.

Formatting Number

Since Calx use Numeral.JS in it’s core, it is use format syntax from Numeral.JS . Documentation below was borrowed from Numeral.JS documentation. Use dollar sign [$] to display currency symbol, comma[,] as thousand separator, and dot [.] as decimal separator, regardless of currency symbol, thousands separator, and decimal separator in language configuration, Calx will replace it automatically.

Thanks to Adam Drapper for creating Numeral.JS https://github.com/adamwdraper/Numeral-js

Numbers

NumberFormatString
10000‘0,0.0000’10,000.0000
10000.23‘0,0’10,000
-10000‘0,0.0’-10,000.0
10000.1234‘0.000’10000.123
10000.1234‘0[.]00000’10000.12340
-10000‘(0,0.0000)’(10,000.0000)
-0.23‘.00’-.23
-0.23‘(.00)’(.23)
0.23‘0.00000’0.23000
0.23‘0.0[0000]’0.23
1230974‘0.0a’1.2m
1460‘0 a’1 k
-104000‘0a’-104k
1‘0o’1st
52‘0o’52nd
23‘0o’23rd
100‘0o’100th

Currency

NumberFormatString
1000.234‘$0,0.00’$1,000.23
1000.2‘0,0[.]00 $’1,000.20 $
1001‘$ 0,0[.]00’$ 1,001
-1000.234‘($0,0)’($1,000)
-1000.234‘$0.00’-$1000.23
1230974‘($ 0.00 a)’$ 1.23 m

Bytes

NumberFormatString
100‘0b’100B
2048‘0 b’2 KB
7884486213‘0.0b’7.3GB
3467479682787‘0.000 b’3.154 TB

Percentages

NumberFormatString
1‘0%’100%
0.974878234‘0.000%’97.488%
-0.43‘0 %’-43 %
0.43‘(0.000 %)’43.000 %

Time

NumberFormatString
25’00:00:00′0:00:25
238’00:00:00′0:03:58
63846’00:00:00′17:44:06
[/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]