You can change Calx’s default behavior as you want by overriding default configuration value. The default configuration value comes with Calx is:

{
    autocalculate : true,
    format        : '0[.]00',
    readonly      : true,
    language      : 'en'
    round         : 3
}

Format

By default, calx will use 0[.]00 as the default format, you can override it to another format as you want

$('#form_element').calx({
    format : '$ 0,0[.]00'
});

Language

The only language defined for number formatting is ‘en’, and it’s loaded by default, where it uses comma [,] as thousands delimiter, dot [.] as decimal delimiter, and dollar sign [$] as currency symbol.

To register your own language settings, simply call the Calx language method

$().calx('language',{
	id : 'id', //id of the language, this sample is Indonesian format
	config: {
	    delimiters: {
		    thousands: '.', //the thousands delimiter
		    decimal: ',' //the decimal delimiter
	    },
	    abbreviations: {
		    thousand: 'rb',
		    million: 'jt',
		    billion: 'M',
		    trillion: 'T'
	    },
	    ordinal : function (number) {
		    return '';
	    },
	    currency: {
		    symbol: 'Rp.'
	    }
	}
});

After new language settings was registered, you can call it when initializing the Calx:

$('#form_element').calx({
    language : 'id'
});

Autocalculate

By default, autocalculate value is true, it tells the Calx to trigger calculation automatically when form element ‘change’ event is triggered, to disable this, simply set the autocalculate value to be false

$('#form_element').calx({
    autocalculate : false
});

when the autocalculate value is false, no calculation result will be displayed when you change the form element value, until you call the Calx ‘update’ method

$('#form_element').calx('update');

Readonly

By default, Calx will mark all input element with data-formula attribute as readonly, you can change this default behavior by setting readonly value to be false

$('#form_element').calx({
    readonly: false
});

Round

When text box get focused, it will display it’s original value instead of formatted one which is usually float number with a lot of decimal digits. Since version 1.1.9 this behaviour can be controlled by round config to limit the number of decimal digits displayed when text box get focused

$('#form_element').calx({
    round: 3
});