简体   繁体   中英

How to implement a SAP UI5 - Cell Formatter in ListReport Template

We are using a List Report template from SAP UI5 template library for a Reporting application.

Now we are facing problem in formatting one particular cell data, which is coming from back-end xsodata service.

Example
Suppose we need to show the time in HH:MM:SS (Hour:Minute:Seconds) format and we are receiving it only in form of seconds.

We have the logic to convert seconds to hours but don't know where to plugin the formatter function.

If it was Smarttable or the sap.m.table, we could have mentioned this in the view itself. how to do this in List Report Template?

Any sort of help is highly appreciated. Thank you in advance.

Try using parts , where one part will be your odata binding and in formatter use the UI5 date formatter . https://sapui5.hana.ondemand.com/explored_v1.html#/sample/sap.ui.core.sample.TypeDateAsDate/preview

 <Text text="{
                path: '/this_Is_the_binding',
                type: 'sap.ui.model.type.DateTime',
                formatOptions: {
                    pattern: 'yyyyMMdd HHmmss'
                }
            }" />

This can solve your issue. You can add pattern as per your need

我是通过为列表报告创建扩展(根据https://sapui5.hana.ondemand.com/#/topic/28e95702b5854b938ac51c4bc2d078ab的“自定义列和单元格”)并在其中设置格式化程序来实现的...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM