Show TOC

sap.ui.model.type.FloatLocate this document in the navigation structure

The Float data type represents a float value.

The source value for this data type, that is, the value given in the model must be given as a number and is transformed into the type of the bound control property:

  • float: No transformation needed
  • integer: Value is rounded using Math.floor
  • string: Value is formatted or parsed according to the given output pattern

Examples how a Float type can be initialized:

// The source value is given as Javascript number. Output is transformed into the type of the bound control property.
// If this type is "string" (e.g. the value property of the TextField control) the used default output pattern parameters depend on locale and fixed settings.

var oType = new sap.ui.model.type.Float();

// The source value is given as Javascript number. Output is transformed into the type of the bound control property.
// If this type is "string" (e.g. the value property of the TextField control) the given output pattern is used (parameters which are not specified are taken from the default pattern)

oType = new sap.ui.model.type.Float({
  minIntegerDigits: 1, // minimal number of non-fraction digits
  maxIntegerDigits: 99, // maximal number of non-fraction digits
  minFractionDigits: 0, // minimal number of fraction digits
  maxFractionDigits: 99, // maximal number of fraction digits
  groupingEnabled: true, // enable grouping (show the grouping separators)
  groupingSeparator: ",", // the used grouping separator
  decimalSeparator: "." // the used decimal separator
});

The Float type supports the following validation constraints:

  • maximum
  • minimum