How to get formatting data for columns without displaying them in table


In my current project, we faced issues while applying formatting to table columns in Fiori if the referenced fields are not required in the output list. e.g. If we are using using sematic colors, we need criticality fields to be added to selected columns list. There are also some scenarios where you may just need the column to derive data for another column in the table and you don’t want the column to be visible in the table. e.g. we hide texts in a column based on value of another column

Following link provides details on how to overcome this limitation:

How do I get data for custom columns (icons, formatters etc.) that are not present in the columns

The blog here explains steps for adding a status field in grid table and applying formatting to table column without selecting referenced columns in output.

Steps to add formatting to Grid Table

  • In the CDS view define fields to provide formatting to table column. In this example we will try to change text color and image of text based on status field
  • In table add a column with ObjectStatus UI element with following properties to change color and icon of the text field. Following link provides details on ObjectStatus UI element:
  • After executing the report we can see the colors and icons not displaying in status column of table.

  • After we manually add statusState and statusIcon columns in table, the text color and icon start showing up.

  • In the table declaration add beforeRebindTable method to modify select column list before triggering odata service call

  • Add following in onBeforeRebingTable method to modify selected column list with additional columns needed for table formatting

  • Now if we execute report, we can see formatting applied by default without adding the related columns in the output list:


Though the blog provides a grid table example, the controller logic can be applied to any other table in fiori application. In case of List report, the controller file needs to be extended to add this additional selection logic.