JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › General Discussions › Decimals in % input of a GridComponent › Reply To: Decimals in % input of a GridComponent
May 25, 2022 at 10:56 am
#103257
admin
Keymaster
Hi,
A built-in input in percentage is having that behavior, because the actual number is already a decimal. For example: the data value is 0.2 = 20%. In the Grid you will see and edit 20%, but when you get the value of the cell, it will be 0.2.
To achieve what you need, you can do the following:
{
label: 'City2', dataType: 'number', cellsFormat: 'n2', editor: {
template: 'numberInput',
numberFormat: {
style: 'decimal',
minimumFractionDigits: 2
}
}, formatFunction(settings) {
settings.value = settings.value + '%';
}, dataField: 'City2', width: 120
},
Best regards,
Peter Stoev
jQWidgets Team
https://www.jqwidgets.com/