Skip to Content
author's profile photo Former Member
Former Member

Master View Grouping on a expanded value

Dear community,

I want to group my entries in my Master View.

<List

id="list"

mode="{device>/listMode}"

select="handleListSelect"

items="{path: '/projects?$expand=customer,wbs_type,project_employees,project_status,details,time_trackings',

sorter: {

path : 'customer/CUSTOMER_NAME',

group: true

}

}" >

The Grouping works but the app does not recognize same CUSTOMER_NAMEs

Two of the attached entries have the same CUSTOMER_ID but I want to group after their CUSTOMER_NAME.

How can I fix it.

Best regards,

Marcel

Grouping.PNG (18.4 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Jul 20, 2016 at 07:10 AM

    Hi,

    In your case customer is the data source name right? so replace the "/" by ">". Try it

    Thank you,

    Regards,

    JK

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      with > there is an endless loading.

      customer is the name of an table.

      In tha main table "projects" there is only CUSTOMER_ID.

      I use phpodataproducer to put my mysql database in a odata service.

      Any other ideas?

      Regards,

      Marcel

  • author's profile photo Former Member
    Former Member
    Posted on Jul 20, 2016 at 08:13 AM

    Hi Marcel,

    Actually I didn't get you properly. If you are looking for custom grouping you can go through below link:

    http://scn.sap.com/community/developer-center/front-end/blog/2013/11/29/custom-sorter-and-grouper

    Thanks & Regards,

    Namita

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      That might be the issue.

      I'm trying to make an workaround with: groupHeaderFactory: '.getGroupHeader'

      But here I still have a problem.

      View:

      items="{path: 'MasterModel>/projects?$expand=customer,wbs_type,project_employees,project_status,details,time_trackings',

      sorter: {

      path : 'MasterModel>CUSTOMER_ID',

      group: '.getGroup'

      },

      groupHeaderFactory: '.getGroupHeader'

      }" >

      Controller:

      getGroup: function (oContext)

      {

      var l_customerName;

      var l_customerId;

      //get CUSTOMER_NAME

      var oModel = this.getView().getModel("MasterModel");

      oModel.read("/customers", null, null, true, fSuccess, fError);

      function fSuccess(oEvent)

      {

      customerId = oContext.getProperty("CUSTOMER_ID") - 1;

      var oCustomers = new sap.ui.model.json.JSONModel(oEvent.results);

      l_customerName = oCustomers.getProperty("/" + customerId + "/CUSTOMER_NAME");

      //console.log(l_customerName);

      };

      function fError(oEvent){

      console.log("An error occured while reading Customers!")

      };

      return {

      key: l_customerId,

      title: l_customerName || "No Customer"

      };

      },

      getGroupHeader: function (oGroup){

      //Set Header

      console.log(oGroup);

      return new sap.m.GroupHeaderListItem( {

      title: oGroup.title,

      upperCase: false

      });

      },

      But if I use "getGroup" the App does not call the methode getGroupHeader, only if I set group: true. But then I can't differntiate between a Key and a title.

      Regrads,

      Marcel

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.