I want to round a number to 2 decimal places in SAPUI5. Could anyone help?


RoundingMode function is used for rounding the number and it uses these parameters: number and how many decimal digits.

Example

You can roundoff and your code will be like this:

<Input value="{
   path: 'helloPanel>/recipient/amount',
   type: 'sap.ui.model.type.Float',
   formatOptions: {
      maxFractionDigits: 2,
      roundingMode: 'away_from_zero'
   }
}"/>


Updated on: 17-Dec-2019

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements