Skip to Content
0

How to set group header formatter on Analytical Column ?

Oct 11, 2016 at 01:44 PM

151

avatar image
Former Member

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)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
avatar image
Former Member Oct 12, 2016 at 02:42 PM
0

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

Show 3 Share
10 |10000 characters needed characters left characters exceeded

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

0
Former Member
Joe Rupert

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

1

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-part-3/

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

Take care!

Joe

0