Skip to Content

How to set group header formatter on Analytical Column ?

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

capturescn.png (110.9 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Oct 12, 2016 at 02:42 PM

    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

    Add comment
    10|10000 characters needed characters exceeded