cancel
Showing results for 
Search instead for 
Did you mean: 

How to set group header formatter on Analytical Column ?

0 Kudos

Hi,

I have implemented an Analytical Table (sap.ui.table.AnalyticalTable) to display data in the form of ALV. I have grouped the data on a column and the grouping works fine.

I would like to format the text of the group header. The documentation states that this is possible by calling the method setGroupHeaderFormatter(oGroupHeaderFormatter) on the Analytical Column (sap.ui.table.AnalyticalColumn).

However there is not enough information on what the parameter oGroupHeaderFormatter should be.

Can anyone suggest what should be supplied as the parameter and how to format the group header value?

Regards,

Melwyn

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Sharing the solution as I managed to get it to work:

onInit: function() {
   //Object that is called for formatting the text on group header
        this.formatGroupHeaderText = {
          CaseText: function(sValue){
          	return sValue.substring(0, sValue.lastIndexOf('#')) //do formatting here
          	}
         };
},

onBeforeRebindTable: function(oEvent) {
   var oTable = sap.ui.getCore().byId("tableName");
   var oColText = oTable.getColumns()[0];
   //sPath should match the function in the object called above.
   var sPath = "CaseText";
   oColText.setGroupHeaderFormatter(this.formatGroupHeaderText[sPath]);
}

Regards,

Melwyn

joe_rupert
Explorer
0 Kudos

Thank you for sharing your answer.

You had a previous archived question on removing duplicates in the Smart Analytical Table in SAPUI5 entitled "Duplicate grouping of rows in Analytical Table" here: https://archive.sap.com/discussions/thread/3936140

I'm curious on how you solved this as the example in SAPUI5 Explored is not working as well (as you noted).

Thank you,

Joe

Hi Joe,

For duplicate grouping you need to make sure that annotations for all fields are created and you also have the GeneratedID property as the only key property in the entity. To remove the duplicates you would need to write logic in your gateway code.

We never ended up using the Analytical table due to so many issues and limited support from SAP and we switched our implementation to using the Tree Table

Regards,

Melwyn

joe_rupert
Explorer
0 Kudos

Hi Melwyn,

Thank you for your response. I ended up figuring most of this out and incorporated it into my blog series here: https://blogs.sap.com/2017/03/23/annotating-and-extending-fiori-element-applications-list-report-par...

I'm not sure if this provides much more information but I was able to get the analytical table working properly.

Take care!

Joe

Answers (0)