Percentage formatting

Tags: #<Tag:0x00007f8b233daa80>

Hi…
I have formatted a cell as numeric and pattern as ‘i,ii%’ but when input is 1 it goes to 100% and 10 it goes to 1000% etc. instead i need 1% and 10%.
I have try
cellProperties.type = ‘numeric’;
cellProperties.numericFormat= {
pattern: ‘i,ii%’
}
and alse
cellProperties.renderer = function (instance, td, row, col, prop, value, cellProperties){
Handsontable.renderers.NumericRenderer.apply(this, arguments);
return td.innerHTML = value +’ %’;
};
Both not working.

Hi @aswram23

How about an approach like this one https://jsfiddle.net/handsoncode/1hzf8ntq/ ?


Hi.
Even in the given example if i provide 1 values output shows 100%. please check the attachment for the same.

Thanks.

Ah, I see. Then you can use this demo https://jsfiddle.net/handsoncode/fLhw0y2x/ (a custom renderer). It will mark all non-numeric cells red (invalid). But it will not crop numeric values with decimal places so if you need to round the numbers you’d need to change the ${value} to the ${Math.round(value)}. Does it support all the requirements now?

Issue got fixed. Thanks @aleksandra_budnik

You’re welcome. I’m happy to help.