Skip to Content
0
Feb 03, 2023 at 01:54 PM

Dynamic Fraction Digits in Sapui5/CDS

203 Views Last edit Feb 03, 2023 at 03:03 PM 2 rev

Hello dear experts.

I am trying to implement a UI5 view with dynamic fraction digits option. Basically there should be a Segmented Button to change the fraction length in the view. The screenshot is taken from the second option. Unfortunately you loose Two Way Binding this way.

decimals.gif

1. Since formatOptions in UI5 cannot be bound to any variable I can't simply implement this via a local json model

<Text text="{
	path: '/number',
	type: 'sap.ui.model.type.Float',
	formatOptions: {
		maxFractionDigits: 2
	}
}" /><br>

2. Using a formatter disables Two-Way Binding, so this does not help either

3. Next I thought of a CDS with parameters, so I could set the fraction digits dynamically via CDS Annotations by sending a parameterized odata request, but it looks like I headed to a dead end here as well.

So I hope I can get some help here.

Attachments

decimals.gif (22.8 kB)