Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Math widget: please specify math_mask #1320

Closed
Chealer opened this issue Nov 22, 2016 · 2 comments
Closed

Math widget: please specify math_mask #1320

Chealer opened this issue Nov 22, 2016 · 2 comments

Comments

@Chealer
Copy link

Chealer commented Nov 22, 2016

The documentation of the Math widget advertises the math_mask option, which allows controlling the output format.

While there are examples of accepted values, there is unfortunately no description of their effect or any actual specification.

Value "0" appears to allow formatting as simple integers (i.e. 123198.8992 shows as "123198").

@Mottie
Copy link
Owner

Mottie commented Nov 22, 2016

Hi @Chealer!

Did you expand the math_mask option? The description contains a lot more details on how to use the mask. It also provides a link to my fork of the javascript-number-formatter plugin; along with this demo.

Essentially the difference between using # and 0 is that when a value of zero is passed to the function, the # mask will return an empty string whereas the 0 mask will return a zero. I will add a note in the documentation.

@Chealer
Copy link
Author

Chealer commented Nov 26, 2016

Thanks for the change @Mottie . I had expanded, but there is no formal specification of how the mask is analyzed either in the example page or in the plugin's documentation.

It took me a few minutes to understand the following:

When there's only one symbol is supplied, system will always treat the single symbol as Decimal. For instance, $.tablesorter.formatMask( '#,###', 1234567.890) will output 1234567,890.

I recommend putting that bullet and the following bullet in the same bullet, and to substitute

When there's only one symbol is supplied, system will always treat the single symbol as Decimal.

with

When the mask contains a single symbol, that symbol will be treated as the decimal mark.

"symbol" should also be replaced with a more exact description, since "#" is also a symbol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants