Skip to Content
avatar image
Former Member

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

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)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Oct 10, 2017 at 12:15 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded