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'
   }
}"/>



Advertisements