Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Add hard-coded text in formatter sap ui5

Hi Experts

                 i am using formatter in util folder to convert the date in a valid form. Now date is coming in red circle area. But I want to write text(delivered date : 25 September 2015) .So how can i write text before date..

I am also share my code..

Please help me out

thanks

Vishnu

Former Member
Former Member replied

another way to do this is

text: {
  parts: ["i18n>deliverydate", "OrderDate"],
  formatter: function(i18nString, orderDate) {
     return i18nString.replace('{0}', com.vikalp.dealermgmt.util.Formatter.OrderDate.call(null, orderDate));
  }
}
// assuming that your have i18n as the resource model
// deliverydate=Delivered Date: {0}
text: {
  path: "OrderDate",
  formatter: function(orderDate) {
     return 'Delivered Date: ' + com.vikalp.dealermgmt.util.Formatter.OrderDate.call(null, orderDate);
  }
}

I prefer the first approach for building enterprise software, we need to have localization of text

Thanks

-D

2 View this answer in context
Not what you were looking for? View more on this topic or Ask a question