Skip to Content

Custom Sort & Group - SAP UI Table - Group Header Issue


I am working on a use case where I have to group the column entries based on a group category and sort the entries with in the group.

I am using sap.ui.Table control. Since, the column group is based on custom criteria I have implemented custom sort with grouping on the data binding using model sorter.

I have followed the following post as an example and adapted it to my case -

Here is my implementation:

var mGroupInfo = {

I: { order: 1, text: "Incidents" },

N: { order: 2, text: "Notifications" }


var fGroup = function(value) { // Must group the values starts with 9 and 1

return utilities.startsWith(value,"9") ? "I" : "N";


var fnGrouper = function(oContext) {

var value = oContext.getProperty(sColBindingPath);

var group = fGroup(value);

return {

key: group,

text: mGroupInfo[group].text



var oSorter = new sap.ui.model.Sorter(sColBindingPath,false,fnGrouper);

oSorter.fnCompare = function(a,b) {

var agroup = mGroupInfo[fGroup(a)].order;

var bgroup = mGroupInfo[fGroup(b)].order;

if (agroup < bgroup) return -1;

if (agroup > bgroup) return 1;

// Sort with in the group if (a < b) return -1;

if (a == b) return 0; if (a > b) return 1;




The entries are sorted correctly according to the group but I do not see the group header text (like "Incidents" for entries start with 9 and "Notifications" for entries start with 1). For this to happen, the grouper function should go through. But while debugging I see that this function is not invoked at all.

Could some one please provide some hints what am missing here !! Thank you.

result.png (10.5 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer