Calx comes with several method member which can be called to perform specific action. Except the ‘language’ and ‘parser’ method, each Calx method should be called after Calx is initialized:

Update

/** init the calx first */
$('#form_element').calx();

/** call the method */
$('#form_element').calx('update');

update method is used to display the calculation result when the autocalculate is disabled. This method will be useful when you don’t want Calx to display calculation result immediately after the form element has been changed by user.

$('#calculate_button').click(function(){
    $('#form_element').calx('update');
});

 

Language

$().calx('language',language_config);

language method is used to register new language settings, for detailed documentation about language settings, please refer to ‘Configuring Calx‘ page

Parser

$().calx('parser',(function(){
    return new Parser
})());

parser method is used to replace internal parser with your own parser

Refresh

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

refresh method is used to re-scan the form to find newly added element. This method will be useful when your form is dynamic by adding more element to the DOM on the fly or updating data-formula by script.

Detach

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

detach method is used to detach calx from the current form, disable any change event, and destroy all internal data.