JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › General Discussions › Change format function number inputs › Reply To: Change format function number inputs
September 9, 2022 at 9:54 am
#103658
Rafa Esparza
Participant
i found this solution for the smart-number-input but it does not work in grids with number cell editing.
// INPUT
<smart-number-input
id="etotartic"
[numberFormat]="{ style: 'currency', currency: 'EUR', minimumFractionDigits: 2 }"
(ngModelChange)="utilService.formatFunctionDotToComma('etotartic', entity.etotartic)">
</smart-number-input>
// FORMAT FUNCTION
public formatFunctionDotToComma(fieldId: string, value: any): void {
if (value !== ''){
const intValue = parseFloat(value);
document.getElementById(fieldId)?.setAttribute('value', intValue.toFixed(2).replace('.', ','));
}
}
- This reply was modified 2 years ago by Rafa Esparza.