Let's follow up this discussion at the Neptune Community

(this forum will be kept in read-only mode)

Format Group Heading in a sap.m.table


I have a table that I want to group by date.  The date field is a datum field and when I sort and group by that field the group header is displayed as 20160101, I would like it to be 01 Jan 2016.  I have seen this on a few fiori apps but cannot replicate, any ideas ?


Hi Darren

You can use a function to change the Group headers. Try this example:


// Default Sorter - Bundle Menu
var binding = tabAppRoleMenu.getBinding("items");
var oSorter1 = new sap.ui.model.Sorter("CATEGORY", false, function(oContext) {
    var guid = oContext.getProperty("CATEGORY");
    var rec = ModelData.Find(tabCategory, "GUID", guid);

    if (rec.length === 0) {
        return {
            key: "",
            text: "No Category"
    } else {
        return {
            key: rec[0].NAME,
            text: rec[0].NAME
var oSorter2 = new sap.ui.model.Sorter("NAME", false, false);
binding.sort([oSorter1, oSorter2]);



Ole Andre 

Thanks Ole Andre

I was racking my brain on this one, solution works great.

var data = modelMasterVisitList.getData( );

var oSorter = new sap.ui.model.Sorter("VDATE", true,function(oContext) {

    var ldate = oContext.getProperty("VDATE");

    return formatDate(ldate);


var binding = MasterVisitList.getBinding("items");


function formatDate(idate){


  var oSAPFormat = sap.ui.core.format.DateFormat.getDateTimeInstance({

    pattern: "yyyyMMdd"


  var oOutFormat = sap.ui.core.format.DateFormat.getDateTimeInstance({

    pattern: "dd.MM.yyyy",

    relative: false


  var oDate = oSAPFormat.parse(idate);

  var formattedText = oOutFormat.format(oDate);

  return formattedText;


1 person likes this
Login or Signup to post a comment