NumeralJS format of percent without multiplying by 100

In Handsontable, you can use an option format

in a cell numeric

to format the values ​​accordingly. Since it uses NumeralJS, I went through the documentation to see how to format the number to just add a% sign and not multiply by 100, but can't find how to do this without setting my own.

Cell example:

{
    "type": "numeric",
    "format": "0.00%"
}

      

When the value is 7, it displays "700.00%"

. I would like to show "7.00%". Any way to do this manually?

+3


source to share


1 answer


I don't think there is a way to do this now without making changes to the numeral.js file .

If you want you can edit function formatPercentage

(find in numberal.js ) by removing the part * 100

:



function formatPercentage (n, format, roundingFunction) {
    var space = '',
        output,
        value = n._value/* * 100*/; // comment out or remove * 100 here

    ...
}

      

+2


source







All Articles