cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAPUI5 Table Column- Order Qty- value Format with Localization in XML View

siriyadav0902
Explorer
0 Likes
1,563

Hi Team,

How to do format of OrderQty in SAP UI5 Table with localization.

Ex: Order Qty: 1,000.01

en-US: 1,000.01

in German format it should dispaly as 1.000,01

How to do this at table column defination.

regards,

Srisailam G

test.png

Accepted Solutions (1)

Accepted Solutions (1)

vedaradhya
Participant
0 Likes

Hi Srisailam,

you can use number format, pass the number and locale to the formatter,

you can refer sdk here

for example :

View.xml

<Table id="productsTable" items="{/ProductCollection}">
	<columns>
		<Column id="netPrice" hAlign="End"><Text text="Price"/></Column>
	</columns>
	<items>
		<ColumnListItem>
			<cells>
		<ObjectNumber number="{parts: [ {path: 'Price'}, {path: 'Locale'} ], formatter:'.numberFormatter'}"/>
			</cells>
		</ColumnListItem>
	</items>
</Table>


formatter

numberFormatter: function(val, locale) {
		
			var oLocale = new sap.ui.core.Locale(locale);
			var oFormatOptions = {
				minFractionDigits: 2,
				maxFractionDigits: 2
			};


			var oFloatFormat = NumberFormat.getInstance(oFormatOptions, oLocale);
			
			return oFloatFormat.format(val);
		}

Regards,

Vedaradhya.

Answers (0)