SAP / openui5

OpenUI5 lets you build enterprise-ready web applications, responsive to all devices, running on almost any browser of your choice.
http://openui5.org
Apache License 2.0
2.94k stars 1.23k forks source link

How to set decimal places in Input using formatOptions using a JSONModel #3982

Closed Mosheh closed 5 months ago

Mosheh commented 6 months ago

OpenUI5 version: https://sapui5.hana.ondemand.com/1.119.2/resources/sap-ui-core.js

Browser/version (+device/version): Versão google chrome 122.0.6261.69

Any other tested browsers/devices(OK/FAIL): This is a feature

Necessity: We need a way to pass a model to formatOptions in Input control controller: var MyModelConfiguration = {MyPropertyDecimalPlaces: 6 }; view.SetModel(new JSONModel(MyModelConfiguration), 'MyModelConfiguration');

view

Steps to reproduce the problem:

  1. Create a view using Input, set formatOptions passing model
  2. Create a controller bonded with view and set model with property (integer) with decimal places
  3. The view needs to show the input accepting the decimal places

What is the expected result? We need the Input control to accept only values with specific decimal places

What happens instead? Today there is no way to do this.

Any other information? (attach screenshot if possible) image

tsanislavgatev commented 6 months ago

Hello @Mosheh,

Can you please try using the StepInput control with displayValuePrecision? https://ui5.sap.com/#/api/sap.m.StepInput%23controlProperties

It allows you to chose the number of allowed digits after the decimal point.

niyap commented 5 months ago

Hello,

Since there is no response from the author for more than 4 weeks I'm closing the ticket.

Kind Regards, Niya