Skip to Content
0

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

Oct 10, 2017 at 10:08 AM

88

avatar image
Former Member

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

test.png (12.8 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Vedaradhya Agrahar Oct 10, 2017 at 12:15 PM
0

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.

Share
10 |10000 characters needed characters left characters exceeded